Loading...
beginner
Problem 01 • Step 01
Mask the Word
The game board needs to show the word with unguessed letters hidden. maskedWord(word, guessedLetters) takes the secret word and an array of guessed letters, and returns a string with spaces between each character:
maskedWord("apple", []) // "_ _ _ _ _"
maskedWord("apple", ["a"]) // "a _ _ _ _"
maskedWord("apple", ["a", "p"]) // "a p p _ _"
Rules
- Each letter in the word is either revealed (if guessed) or shown as
"_" - Letters are separated by spaces:
"a _ _ l e", not"a__le" - Matching is case-insensitive. Guessing
"a"reveals"A"in the word - Wrong guesses have no effect on the output
Look at game.html (read-only) to see how this function will be used on the page.