Harry Potter House Quiz - 100% Mind-blowing Result

Harry Potter quizzes like this are about as much as the sorting hat. Get ready to get your bags packed and go into a floating car on your route to Hogwarts.

This is image title

The Harry Potter House Quiz has everything you want to discover, definitively and exactly which Hogwarts house the sorting hat believes you should be in. And remember, the sorting hat is ever right.

So what are you waiting for? Take the Harry Potter quiz to discover where you’ll be giving your time at Hogwarts, and don’t skip sharing your results with your classmates on social media.

Harry Potter Houses

Right, there are 4 houses in Harry Potter, each one slightly distinct from the other. Before we move on to picking the ideal house for you, young magician, know the terms of each of them. It is very powerful.

Gryffindor

The name Gryffindor comes from the name of Godric Gryffindor, one of the authors of the school. The students of this house are frequently related to as “Gryffindors.” Gryffindor is known to compete with another house - Slytherin. Many great characteristics describe the pupils of this house. To become a part of Gryffindor, you require to be brave, defined, bold, and loving. There are Albus Dumbledore, Rubeus Hagrid, Minerva McGonagall, and Artur Weasley, among the famous Gryffindors.

Slytherin

As stated above, Slytherin is a house that has always competed with Gryffindor. The house is called after Salazar Slytherin - one of the authors of the school of Witchcraft and Wizardry. Slytherin is essentially connected with a house where we get clever, cunning, and goal-driven students. Usually, there are exceptions, as not all students are marked by these features. Slytherin students are usually thought to be mean. However, this is just a stereotype. Important members of Slytherin, among others, introduce Tom Riddle, Severus Snape, Lucius Malfoy, and Merlin.

Ravenclaw

Ravenclaw is a house founded by Rowena Ravenclaw, one of the four traditional founders of Hogwarts. Rowena was the greatest of all wisdom, clever, and intelligent, and that is what Ravenclaw students are, as a rule. Ravenclaw is the house of science, wisdom, and ability. Many features that need a strong character, such as individualism, openness, and originality, are appreciated here. The Ravenclaw students just had any opponents from other houses. Their attitude was rather friendly. Famous members of Ravenclaw, among others, add Sybill Trelawney, Filius Flitwick, or Gilderoy Lockhart.

Hufflepuff

Lastly - the fair Hufflepuff. The house was established by Helga Hufflepuff, who was identified by a friendly nature towards everyone. Hufflepuff members had to have the same features as the founder-friendly attitude; they should be nice and comfortable. Additionally, they should also be hardworking, fair, tolerant, honest, and calm. Not many people understand, but Hufflepuff students should also be imaginative. The house was distinguished above all by a cheerful attitude, friendship, and common help. Famous members of Hufflepuff, among others, combine Theseus Scamander, Newton Scamander, or Amos Diggory.

Conclusion

We can find a dozen more pros to become a part of each House. In truth, all of them are great and should remain one united family to raise exceptional wizards and witches. Enjoy this Harry Potter House quiz and share your results with us! Remember that it’s about where you’ll do the best. The result may surprise you!

#harry potter house quiz #harry potter house quiz pottermore version #pottermore sorting hat quiz #gryffindor #hufflepuff #slytherin

What is GEEK

Buddha Community

Harry Potter House Quiz - 100% Mind-blowing Result

Harry Potter House Quiz - 100% Mind-blowing Result

Harry Potter quizzes like this are about as much as the sorting hat. Get ready to get your bags packed and go into a floating car on your route to Hogwarts.

This is image title

The Harry Potter House Quiz has everything you want to discover, definitively and exactly which Hogwarts house the sorting hat believes you should be in. And remember, the sorting hat is ever right.

So what are you waiting for? Take the Harry Potter quiz to discover where you’ll be giving your time at Hogwarts, and don’t skip sharing your results with your classmates on social media.

Harry Potter Houses

Right, there are 4 houses in Harry Potter, each one slightly distinct from the other. Before we move on to picking the ideal house for you, young magician, know the terms of each of them. It is very powerful.

Gryffindor

The name Gryffindor comes from the name of Godric Gryffindor, one of the authors of the school. The students of this house are frequently related to as “Gryffindors.” Gryffindor is known to compete with another house - Slytherin. Many great characteristics describe the pupils of this house. To become a part of Gryffindor, you require to be brave, defined, bold, and loving. There are Albus Dumbledore, Rubeus Hagrid, Minerva McGonagall, and Artur Weasley, among the famous Gryffindors.

Slytherin

As stated above, Slytherin is a house that has always competed with Gryffindor. The house is called after Salazar Slytherin - one of the authors of the school of Witchcraft and Wizardry. Slytherin is essentially connected with a house where we get clever, cunning, and goal-driven students. Usually, there are exceptions, as not all students are marked by these features. Slytherin students are usually thought to be mean. However, this is just a stereotype. Important members of Slytherin, among others, introduce Tom Riddle, Severus Snape, Lucius Malfoy, and Merlin.

Ravenclaw

Ravenclaw is a house founded by Rowena Ravenclaw, one of the four traditional founders of Hogwarts. Rowena was the greatest of all wisdom, clever, and intelligent, and that is what Ravenclaw students are, as a rule. Ravenclaw is the house of science, wisdom, and ability. Many features that need a strong character, such as individualism, openness, and originality, are appreciated here. The Ravenclaw students just had any opponents from other houses. Their attitude was rather friendly. Famous members of Ravenclaw, among others, add Sybill Trelawney, Filius Flitwick, or Gilderoy Lockhart.

Hufflepuff

Lastly - the fair Hufflepuff. The house was established by Helga Hufflepuff, who was identified by a friendly nature towards everyone. Hufflepuff members had to have the same features as the founder-friendly attitude; they should be nice and comfortable. Additionally, they should also be hardworking, fair, tolerant, honest, and calm. Not many people understand, but Hufflepuff students should also be imaginative. The house was distinguished above all by a cheerful attitude, friendship, and common help. Famous members of Hufflepuff, among others, combine Theseus Scamander, Newton Scamander, or Amos Diggory.

Conclusion

We can find a dozen more pros to become a part of each House. In truth, all of them are great and should remain one united family to raise exceptional wizards and witches. Enjoy this Harry Potter House quiz and share your results with us! Remember that it’s about where you’ll do the best. The result may surprise you!

#harry potter house quiz #harry potter house quiz pottermore version #pottermore sorting hat quiz #gryffindor #hufflepuff #slytherin

Guide To Selling A House Fast During OR After Divorce In Riverside

Divorce can be an excruciating experience both emotionally and financially. But, part of the blow is mitigated if financial issues are sorted. Connect with Savannah Properties, we will provide tips on how to sell a house fast Riverside after divorce. When you sell the house after divorce, you can pay off your financial liabilities without much of a problem. So, the ideal thing to do is sell the property and divide the proceeds, so that neither of the party has an issue.

#sellmyhouservierside #sell house riverside #sell house fast riverside #sell house cincinnati #sell house hamilton #sell house fast hamilton

Anastasia soda

Anastasia soda

1624316400

HOW TO FLICK A CARD like HARRY POTTER in Now You See Me. DO NOT MISS!!!

In this video, I show you how to FLICK A CARD like HARRY POTTER in Now You See Me. SNAP a card IMPOSSIBLY from hand to hand!

ABOUT: This is the move I taught Daniel Radcliffe for the Now You See Me (2) movie - SNAPSHOT. Snapshot allows you to flick a card impossibly from one hand to the other with the SNAP of your fingers! This is one of my favorite card moves of all time.

Welcome to the first episode of the “Invest in Yourself - Cardistry and Magic Edition” series. In these episodes, I will showcase and teach cardistry or a magic sleight whilst teaching it to my friends and family. This way, I get to learn alongside everyone and try to correct the problems YOU may encounter.

What kind of an investment channel would this be if I didn’t teach some dope cardistry and magic? Beyond investing in the stock market (dividends), it’s equally important to invest in YOURSELF. Grab a deck of cards, and let’s get started.

📺 The video in this post was made by Andrei Jikh
The origin of the article: https://www.youtube.com/watch?v=WGOadynU9qo
🔺 DISCLAIMER: The article is for information sharing. The content of this video is solely the opinions of the speaker who is not a licensed financial advisor or registered investment advisor. Not investment advice or legal advice.
Cryptocurrency trading is VERY risky. Make sure you understand these risks and that you are responsible for what you do with your money
🔥 If you’re a beginner. I believe the article below will be useful to you ☞ What You Should Know Before Investing in Cryptocurrency - For Beginner
⭐ ⭐ ⭐The project is of interest to the community. Join to Get free ‘GEEK coin’ (GEEKCASH coin)!
☞ **-----CLICK HERE-----**⭐ ⭐ ⭐
Thanks for visiting and watching! Please don’t forget to leave a like, comment and share!

#bitcoin #blockchain #harry potter #flick a card #how to flick a card like harry potter in now you see me #now you see me

中條 美冬

1656510900

HTML、CSS、Javascriptを使用してハングマンゲームを作成する方法

このガイドでは、HTML、CSS、およびJavascriptを使用して絞首刑執行人のゲームを作成する方法を学習します。HTML、CSS、Javascriptを使用して絞首刑執行人のゲームを作成します。HTML、CSS、JavaScriptの3つのファイルを作成する必要があります 

1:まず、HTMLファイルを作成します

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Hangman</title>
    <!-- Google Fonts -->
    <link
      href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;600&display=swap"
      rel="stylesheet"
    />
    <!-- Stylesheet -->
    <link rel="stylesheet" href="style.css" />
  </head>
  <body>
    <div class="container">
      <div id="options-container"></div>
      <div id="letter-container" class="letter-container hide"></div>
      <div id="user-input-section"></div>
      <canvas id="canvas"></canvas>
      <div id="new-game-container" class="new-game-popup hide">
        <div id="result-text"></div>
        <button id="new-game-button">New Game</button>
      </div>
    </div>
    <!-- Script -->
    <script src="script.js"></script>
  </body>
</html>

 

2:次に、CSSファイルを作成します

 

* {
  padding: 0;
  margin: 0;
  box-sizing: border-box;
  font-family: "Poppins", sans-serif;
}
body {
  background-color: #f4c531;
}
.container {
  font-size: 16px;
  background-color: #ffffff;
  width: 90vw;
  max-width: 34em;
  position: absolute;
  transform: translate(-50%, -50%);
  top: 50%;
  left: 50%;
  padding: 3em;
  border-radius: 0.6em;
  box-shadow: 0 1.2em 2.4em rgba(111, 85, 0, 0.25);
}
#options-container {
  text-align: center;
}
#options-container div {
  width: 100%;
  display: flex;
  justify-content: space-between;
  margin: 1.2em 0 2.4em 0;
}
#options-container button {
  padding: 0.6em 1.2em;
  border: 3px solid #000000;
  background-color: #ffffff;
  color: #000000;
  border-radius: 0.3em;
  text-transform: capitalize;
}
#options-container button:disabled {
  border: 3px solid #808080;
  color: #808080;
  background-color: #efefef;
}
#options-container button.active {
  background-color: #f4c531;
  border: 3px solid #000000;
  color: #000000;
}
.letter-container {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6em;
}
#letter-container button {
  height: 2.4em;
  width: 2.4em;
  border-radius: 0.3em;
  background-color: #ffffff;
}
.new-game-popup {
  background-color: #ffffff;
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  border-radius: 0.6em;
}

#user-input-section {
  display: flex;
  justify-content: center;
  font-size: 1.8em;
  margin: 0.6em 0 1.2em 0;
}
canvas {
  display: block;
  margin: auto;
  border: 1px solid #000000;
}
.hide {
  display: none;
}
#result-text h2 {
  font-size: 1.8em;
  text-align: center;
}
#result-text p {
  font-size: 1.25em;
  margin: 1em 0 2em 0;
}
#result-text span {
  font-weight: 600;
}
#new-game-button {
  font-size: 1.25em;
  padding: 0.5em 1em;
  background-color: #f4c531;
  border: 3px solid #000000;
  color: #000000;
  border-radius: 0.2em;
}
.win-msg {
  color: #39d78d;
}
.lose-msg {
  color: #fe5152;
}

 

3:最後に、JavaScriptファイルを作成します


 

//Initial References
const letterContainer = document.getElementById("letter-container");
const optionsContainer = document.getElementById("options-container");
const userInputSection = document.getElementById("user-input-section");
const newGameContainer = document.getElementById("new-game-container");
const newGameButton = document.getElementById("new-game-button");
const canvas = document.getElementById("canvas");
const resultText = document.getElementById("result-text");

//Options values for buttons
let options = {
  fruits: [
    "Apple",
    "Blueberry",
    "Mandarin",
    "Pineapple",
    "Pomegranate",
    "Watermelon",
  ],
  animals: ["Hedgehog", "Rhinoceros", "Squirrel", "Panther", "Walrus", "Zebra"],
  countries: [
    "India",
    "Hungary",
    "Kyrgyzstan",
    "Switzerland",
    "Zimbabwe",
    "Dominica",
  ],
};

//count
let winCount = 0;
let count = 0;

let chosenWord = "";

//Display option buttons
const displayOptions = () => {
  optionsContainer.innerHTML += `<h3>Please Select An Option</h3>`;
  let buttonCon = document.createElement("div");
  for (let value in options) {
    buttonCon.innerHTML += `<button class="options" onclick="generateWord('${value}')">${value}</button>`;
  }
  optionsContainer.appendChild(buttonCon);
};

//Block all the Buttons
const blocker = () => {
  let optionsButtons = document.querySelectorAll(".options");
  let letterButtons = document.querySelectorAll(".letters");
  //disable all options
  optionsButtons.forEach((button) => {
    button.disabled = true;
  });

  //disable all letters
  letterButtons.forEach((button) => {
    button.disabled.true;
  });
  newGameContainer.classList.remove("hide");
};

//Word Generator
const generateWord = (optionValue) => {
  let optionsButtons = document.querySelectorAll(".options");
  //If optionValur matches the button innerText then highlight the button
  optionsButtons.forEach((button) => {
    if (button.innerText.toLowerCase() === optionValue) {
      button.classList.add("active");
    }
    button.disabled = true;
  });

  //initially hide letters, clear previous word
  letterContainer.classList.remove("hide");
  userInputSection.innerText = "";

  let optionArray = options[optionValue];
  //choose random word
  chosenWord = optionArray[Math.floor(Math.random() * optionArray.length)];
  chosenWord = chosenWord.toUpperCase();

  //replace every letter with span containing dash
  let displayItem = chosenWord.replace(/./g, '<span class="dashes">_</span>');

  //Display each element as span
  userInputSection.innerHTML = displayItem;
};

//Initial Function (Called when page loads/user presses new game)
const initializer = () => {
  winCount = 0;
  count = 0;

  //Initially erase all content and hide letteres and new game button
  userInputSection.innerHTML = "";
  optionsContainer.innerHTML = "";
  letterContainer.classList.add("hide");
  newGameContainer.classList.add("hide");
  letterContainer.innerHTML = "";

  //For creating letter buttons
  for (let i = 65; i < 91; i++) {
    let button = document.createElement("button");
    button.classList.add("letters");
    //Number to ASCII[A-Z]
    button.innerText = String.fromCharCode(i);
    //character button click
    button.addEventListener("click", () => {
      let charArray = chosenWord.split("");
      let dashes = document.getElementsByClassName("dashes");
      //if array contains clciked value replace the matched dash with letter else dram on canvas
      if (charArray.includes(button.innerText)) {
        charArray.forEach((char, index) => {
          //if character in array is same as clicked button
          if (char === button.innerText) {
            //replace dash with letter
            dashes[index].innerText = char;
            //increment counter
            winCount += 1;
            //if winCount equals word lenfth
            if (winCount == charArray.length) {
              resultText.innerHTML = `<h2 class='win-msg'>You Win!!</h2><p>The word was <span>${chosenWord}</span></p>`;
              //block all buttons
              blocker();
            }
          }
        });
      } else {
        //lose count
        count += 1;
        //for drawing man
        drawMan(count);
        //Count==6 because head,body,left arm, right arm,left leg,right leg
        if (count == 6) {
          resultText.innerHTML = `<h2 class='lose-msg'>You Lose!!</h2><p>The word was <span>${chosenWord}</span></p>`;
          blocker();
        }
      }
      //disable clicked button
      button.disabled = true;
    });
    letterContainer.append(button);
  }

  displayOptions();
  //Call to canvasCreator (for clearing previous canvas and creating initial canvas)
  let { initialDrawing } = canvasCreator();
  //initialDrawing would draw the frame
  initialDrawing();
};

//Canvas
const canvasCreator = () => {
  let context = canvas.getContext("2d");
  context.beginPath();
  context.strokeStyle = "#000";
  context.lineWidth = 2;

  //For drawing lines
  const drawLine = (fromX, fromY, toX, toY) => {
    context.moveTo(fromX, fromY);
    context.lineTo(toX, toY);
    context.stroke();
  };

  const head = () => {
    context.beginPath();
    context.arc(70, 30, 10, 0, Math.PI * 2, true);
    context.stroke();
  };

  const body = () => {
    drawLine(70, 40, 70, 80);
  };

  const leftArm = () => {
    drawLine(70, 50, 50, 70);
  };

  const rightArm = () => {
    drawLine(70, 50, 90, 70);
  };

  const leftLeg = () => {
    drawLine(70, 80, 50, 110);
  };

  const rightLeg = () => {
    drawLine(70, 80, 90, 110);
  };

  //initial frame
  const initialDrawing = () => {
    //clear canvas
    context.clearRect(0, 0, context.canvas.width, context.canvas.height);
    //bottom line
    drawLine(10, 130, 130, 130);
    //left line
    drawLine(10, 10, 10, 131);
    //top line
    drawLine(10, 10, 70, 10);
    //small top line
    drawLine(70, 10, 70, 20);
  };

  return { initialDrawing, head, body, leftArm, rightArm, leftLeg, rightLeg };
};

//draw the man
const drawMan = (count) => {
  let { head, body, leftArm, rightArm, leftLeg, rightLeg } = canvasCreator();
  switch (count) {
    case 1:
      head();
      break;
    case 2:
      body();
      break;
    case 3:
      leftArm();
      break;
    case 4:
      rightArm();
      break;
    case 5:
      leftLeg();
      break;
    case 6:
      rightLeg();
      break;
    default:
      break;
  }
};

//New Game
newGameButton.addEventListener("click", initializer);
window.onload = initializer;

これで、HTML、CSS、およびJavascriptを使用して絞首刑執行人のゲームを正常に作成できました。

CODE VN

CODE VN

1656492720

Cách tạo trò chơi Hangman bằng HTML, CSS & Javascript

Trong hướng dẫn này, chúng ta sẽ học cách tạo trò chơi treo cổ bằng HTML, CSS & Javascript. Để tạo trò chơi treo cổ bằng HTML, CSS & Javascript. Bạn cần tạo ba tệp HTML, CSS & JavaScript 

1: Đầu tiên, tạo một tệp HTML

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Hangman</title>
    <!-- Google Fonts -->
    <link
      href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;600&display=swap"
      rel="stylesheet"
    />
    <!-- Stylesheet -->
    <link rel="stylesheet" href="style.css" />
  </head>
  <body>
    <div class="container">
      <div id="options-container"></div>
      <div id="letter-container" class="letter-container hide"></div>
      <div id="user-input-section"></div>
      <canvas id="canvas"></canvas>
      <div id="new-game-container" class="new-game-popup hide">
        <div id="result-text"></div>
        <button id="new-game-button">New Game</button>
      </div>
    </div>
    <!-- Script -->
    <script src="script.js"></script>
  </body>
</html>

 

2: Thứ hai, tạo một tệp CSS

 

* {
  padding: 0;
  margin: 0;
  box-sizing: border-box;
  font-family: "Poppins", sans-serif;
}
body {
  background-color: #f4c531;
}
.container {
  font-size: 16px;
  background-color: #ffffff;
  width: 90vw;
  max-width: 34em;
  position: absolute;
  transform: translate(-50%, -50%);
  top: 50%;
  left: 50%;
  padding: 3em;
  border-radius: 0.6em;
  box-shadow: 0 1.2em 2.4em rgba(111, 85, 0, 0.25);
}
#options-container {
  text-align: center;
}
#options-container div {
  width: 100%;
  display: flex;
  justify-content: space-between;
  margin: 1.2em 0 2.4em 0;
}
#options-container button {
  padding: 0.6em 1.2em;
  border: 3px solid #000000;
  background-color: #ffffff;
  color: #000000;
  border-radius: 0.3em;
  text-transform: capitalize;
}
#options-container button:disabled {
  border: 3px solid #808080;
  color: #808080;
  background-color: #efefef;
}
#options-container button.active {
  background-color: #f4c531;
  border: 3px solid #000000;
  color: #000000;
}
.letter-container {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6em;
}
#letter-container button {
  height: 2.4em;
  width: 2.4em;
  border-radius: 0.3em;
  background-color: #ffffff;
}
.new-game-popup {
  background-color: #ffffff;
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  border-radius: 0.6em;
}

#user-input-section {
  display: flex;
  justify-content: center;
  font-size: 1.8em;
  margin: 0.6em 0 1.2em 0;
}
canvas {
  display: block;
  margin: auto;
  border: 1px solid #000000;
}
.hide {
  display: none;
}
#result-text h2 {
  font-size: 1.8em;
  text-align: center;
}
#result-text p {
  font-size: 1.25em;
  margin: 1em 0 2em 0;
}
#result-text span {
  font-weight: 600;
}
#new-game-button {
  font-size: 1.25em;
  padding: 0.5em 1em;
  background-color: #f4c531;
  border: 3px solid #000000;
  color: #000000;
  border-radius: 0.2em;
}
.win-msg {
  color: #39d78d;
}
.lose-msg {
  color: #fe5152;
}

 

3: Cuối cùng, tạo một tệp JavaScript


 

//Initial References
const letterContainer = document.getElementById("letter-container");
const optionsContainer = document.getElementById("options-container");
const userInputSection = document.getElementById("user-input-section");
const newGameContainer = document.getElementById("new-game-container");
const newGameButton = document.getElementById("new-game-button");
const canvas = document.getElementById("canvas");
const resultText = document.getElementById("result-text");

//Options values for buttons
let options = {
  fruits: [
    "Apple",
    "Blueberry",
    "Mandarin",
    "Pineapple",
    "Pomegranate",
    "Watermelon",
  ],
  animals: ["Hedgehog", "Rhinoceros", "Squirrel", "Panther", "Walrus", "Zebra"],
  countries: [
    "India",
    "Hungary",
    "Kyrgyzstan",
    "Switzerland",
    "Zimbabwe",
    "Dominica",
  ],
};

//count
let winCount = 0;
let count = 0;

let chosenWord = "";

//Display option buttons
const displayOptions = () => {
  optionsContainer.innerHTML += `<h3>Please Select An Option</h3>`;
  let buttonCon = document.createElement("div");
  for (let value in options) {
    buttonCon.innerHTML += `<button class="options" onclick="generateWord('${value}')">${value}</button>`;
  }
  optionsContainer.appendChild(buttonCon);
};

//Block all the Buttons
const blocker = () => {
  let optionsButtons = document.querySelectorAll(".options");
  let letterButtons = document.querySelectorAll(".letters");
  //disable all options
  optionsButtons.forEach((button) => {
    button.disabled = true;
  });

  //disable all letters
  letterButtons.forEach((button) => {
    button.disabled.true;
  });
  newGameContainer.classList.remove("hide");
};

//Word Generator
const generateWord = (optionValue) => {
  let optionsButtons = document.querySelectorAll(".options");
  //If optionValur matches the button innerText then highlight the button
  optionsButtons.forEach((button) => {
    if (button.innerText.toLowerCase() === optionValue) {
      button.classList.add("active");
    }
    button.disabled = true;
  });

  //initially hide letters, clear previous word
  letterContainer.classList.remove("hide");
  userInputSection.innerText = "";

  let optionArray = options[optionValue];
  //choose random word
  chosenWord = optionArray[Math.floor(Math.random() * optionArray.length)];
  chosenWord = chosenWord.toUpperCase();

  //replace every letter with span containing dash
  let displayItem = chosenWord.replace(/./g, '<span class="dashes">_</span>');

  //Display each element as span
  userInputSection.innerHTML = displayItem;
};

//Initial Function (Called when page loads/user presses new game)
const initializer = () => {
  winCount = 0;
  count = 0;

  //Initially erase all content and hide letteres and new game button
  userInputSection.innerHTML = "";
  optionsContainer.innerHTML = "";
  letterContainer.classList.add("hide");
  newGameContainer.classList.add("hide");
  letterContainer.innerHTML = "";

  //For creating letter buttons
  for (let i = 65; i < 91; i++) {
    let button = document.createElement("button");
    button.classList.add("letters");
    //Number to ASCII[A-Z]
    button.innerText = String.fromCharCode(i);
    //character button click
    button.addEventListener("click", () => {
      let charArray = chosenWord.split("");
      let dashes = document.getElementsByClassName("dashes");
      //if array contains clciked value replace the matched dash with letter else dram on canvas
      if (charArray.includes(button.innerText)) {
        charArray.forEach((char, index) => {
          //if character in array is same as clicked button
          if (char === button.innerText) {
            //replace dash with letter
            dashes[index].innerText = char;
            //increment counter
            winCount += 1;
            //if winCount equals word lenfth
            if (winCount == charArray.length) {
              resultText.innerHTML = `<h2 class='win-msg'>You Win!!</h2><p>The word was <span>${chosenWord}</span></p>`;
              //block all buttons
              blocker();
            }
          }
        });
      } else {
        //lose count
        count += 1;
        //for drawing man
        drawMan(count);
        //Count==6 because head,body,left arm, right arm,left leg,right leg
        if (count == 6) {
          resultText.innerHTML = `<h2 class='lose-msg'>You Lose!!</h2><p>The word was <span>${chosenWord}</span></p>`;
          blocker();
        }
      }
      //disable clicked button
      button.disabled = true;
    });
    letterContainer.append(button);
  }

  displayOptions();
  //Call to canvasCreator (for clearing previous canvas and creating initial canvas)
  let { initialDrawing } = canvasCreator();
  //initialDrawing would draw the frame
  initialDrawing();
};

//Canvas
const canvasCreator = () => {
  let context = canvas.getContext("2d");
  context.beginPath();
  context.strokeStyle = "#000";
  context.lineWidth = 2;

  //For drawing lines
  const drawLine = (fromX, fromY, toX, toY) => {
    context.moveTo(fromX, fromY);
    context.lineTo(toX, toY);
    context.stroke();
  };

  const head = () => {
    context.beginPath();
    context.arc(70, 30, 10, 0, Math.PI * 2, true);
    context.stroke();
  };

  const body = () => {
    drawLine(70, 40, 70, 80);
  };

  const leftArm = () => {
    drawLine(70, 50, 50, 70);
  };

  const rightArm = () => {
    drawLine(70, 50, 90, 70);
  };

  const leftLeg = () => {
    drawLine(70, 80, 50, 110);
  };

  const rightLeg = () => {
    drawLine(70, 80, 90, 110);
  };

  //initial frame
  const initialDrawing = () => {
    //clear canvas
    context.clearRect(0, 0, context.canvas.width, context.canvas.height);
    //bottom line
    drawLine(10, 130, 130, 130);
    //left line
    drawLine(10, 10, 10, 131);
    //top line
    drawLine(10, 10, 70, 10);
    //small top line
    drawLine(70, 10, 70, 20);
  };

  return { initialDrawing, head, body, leftArm, rightArm, leftLeg, rightLeg };
};

//draw the man
const drawMan = (count) => {
  let { head, body, leftArm, rightArm, leftLeg, rightLeg } = canvasCreator();
  switch (count) {
    case 1:
      head();
      break;
    case 2:
      body();
      break;
    case 3:
      leftArm();
      break;
    case 4:
      rightArm();
      break;
    case 5:
      leftLeg();
      break;
    case 6:
      rightLeg();
      break;
    default:
      break;
  }
};

//New Game
newGameButton.addEventListener("click", initializer);
window.onload = initializer;

Bây giờ bạn đã tạo thành công trò chơi treo cổ bằng HTML, CSS & Javascript.