Workshop › Hangman › Step 7 of 36
Now we hide the word: one _ per letter, with spaces between them. masked() builds that text.
```js
let word
const masked = () => [...word].map((letter) => '_').join(' ')
ctx.fillText(masked(), canvas.width / 2, 340)
```() => ... is a short function (an arrow function). masked() runs it and gets back what is after the arrow.[...word] spreads the word into its letters: 'TIGER' → ['T', 'I', 'G', 'E', 'R']..map((letter) => '_') makes a new array with one item per letter, here always '_'..join(' ') glues the items into one text with a space between them: '_ _ _ _ _'.draw now writes masked() instead of word.let word, leave an empty line and write the masked line.draw, replace word in fillText(word, ...) with masked(). Press Run.Skills: Arrays and objects, Functions
← Write the word Remember the guesses →