Recreate the classic game of Hangman! Your version, however, will exist entirely in the Javascript console and/or in alert boxes.
Here's a refresher on how the game works. You can approach this however you'd like. If you need help, we've included a few hints here.
Here are some links to some methods that may help you. They are not required. You can complete this exercise without using any -- well, most -- of these.
- tl;dr: Convert string into array of characters.
- tl;dr: Convert array to string.
- tl;dr: Asking for user input.
- tl;dr: Replace characters with other characters.
- tl;dr: Check if array contains a value.
- tl;dr: Find all elements in array that match a condition.
- tl;dr: Check if characters in a string match a regular expression.
"abc".match(/a/) // => ["a"]
"abc".match(/d/) // => null
- Allow the user to play again after win/loss without refreshing the page.
- Create a menu that shows up when you start and win/lose the game. In the below example, if the user inputs
1
, the game begins. If the user inputs3
, the game closes.
Welcome to Hangman!
1. Play Game
2. Help / How To Play
3. Quit
- Draw ASCII art to represent guesses remaining with an actual hangman. Some inspiration...
_______
|/ |
| (_)
| \|/
| |
| / \
|
|___