Skip to content

ga-wdi-exercises/hangman-lab

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Hangman JS

Your Task

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.

Helpful Resources

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.

.split

  • tl;dr: Convert string into array of characters.

.join

  • tl;dr: Convert array to string.

.prompt

  • tl;dr: Asking for user input.

.replace

  • tl;dr: Replace characters with other characters.

.includes

  • tl;dr: Check if array contains a value.

.filter

  • tl;dr: Find all elements in array that match a condition.

.match

  • tl;dr: Check if characters in a string match a regular expression.
"abc".match(/a/) // => ["a"]
"abc".match(/d/) // => null

Bonuses

Lvl. 1

  • Allow the user to play again after win/loss without refreshing the page.

Lvl. 2

  • 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 inputs 3, the game closes.
Welcome to Hangman!

1. Play Game
2. Help / How To Play
3. Quit

Lvl. 3

  • Draw ASCII art to represent guesses remaining with an actual hangman. Some inspiration...
_______
|/      |
|      (_)
|      \|/
|       |
|      / \
|
|___

Releases

No releases published

Packages

No packages published