Prompt
Implement the logic for a Hangman-style word guessing game.
Write three pure functions:
getDisplay(word, guessed)— returns the word with unguessed letters as underscores (e.g. "P _ K A _ H U")processGuess(letter, state)— processes a letter guess, returns new { guessed, wrong, gameOver, won }isGameOver(state)— returns { won: boolean, lost: boolean }
The word is "PIKACHU", max 6 wrong guesses.
Live Preview
_ _ _ _ _ _ _ _ _ _
Hints
Solution
Your Code
15 min