Open coolaj86 opened 11 years ago
For Hangman is the first step show the user # letters in the word (vs the word itself)? Right now it says: "The computer selects a word at random from a wordbank and shows it to the user".
Good catch. Yes, show the number of blank spaces such as _ _ _ _ _ _ _ _ _ _
for watermelon
Hangman
Here are the rules:
Bonus: use jQuery (sample code that may help with the bonus: https://gist.github.com/coolaj86/5905472)
Hints
This should be the output if the word is
watermelon
and I have guessed["e", "m", "l"]
:This should be the output if I guess incorrectly for the 5th time:
Console
At the end you should have a function
guess
that accepts a single letter. Each timeguess
is called it should be printing out either the number of guesses remaining or the correctly guessed words..split('')
method will come in handyconsole.log()
to show a modified copy of the string that only contains the letters in the guessed letter?forEach
to iterate over each guess.prompt
jQuery
Start with this template:
<button type="button" class="js-make-guess"></button>
click
handler tojs-make-guess
that gets prints something to the screen<input class="js-letter" />
and get it's value with jQueryguess
and passes in the input's value<div class="js-message"></div>
and use jQuery's.text()
method to show the message in the browser