Hangman Game - Guess a letter

<PLEASE USE THIS TEMPLATE TO HELP YOU CREATE A GREAT POST!>

<Below this line, add a link to the EXACT exercise that you are stuck at.>

<Below this line, in what way does your code behave incorrectly? Include ALL error messages.>
Hi everyone!

I decided to start with the hangman and I’m trying to find the best way to setup the alphabet and save the value of the guessed letter.

This is what I have now, but I don’t know how to save the clicked letter in a variable. Should I program it differently?

```

var abc = [“a”, “b”, “c”, “d”, “e”, “f”, “g”, “h”, “i”, “j”, “k”, “l”, “m”, “n”, “o”, “p”, “q”, “r”, “s”, “t”, “u”, “v”, “w”, “x”, “y”, “z”];
var HTMLletterStart = ‘

’;
var HTMLletter = ‘
%data%
’;

for (var i = 0; i < abc.length; i++){
('.ABCletters').append(HTMLletterStart); var formattedLetter = HTMLletter.replace("%data%", abc[i]); (".letter-entry:last").append(formattedLetter);
}

<do not remove the three backticks above>

Not sure what you mean by “saving the value of the guessed letter” or “save the clicked letter”
If you mean a representation of what the user sees (initially all underscores), wouldn’t an array support all the operations that you need?

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.