Workshop › Wordle-style Word Guess › Step 18 of 26
A line under the grid tells the player what is happening: an invitation while playing, the result when it is over. After a loss it reveals the answer; never finding out would be frustrating.
```js
ctx.font = 'bold 16px sans-serif'
ctx.fillStyle = 'white'
let message = 'Guess the five-letter word'
if (state === 'won') message = 'You got it! Enter for a new word'
if (state === 'lost') message = 'It was ' + answer.toUpperCase() + '. Enter for a new word'
ctx.fillText(message, canvas.width / 2, 393)
```message starts as the invitation; each if replaces it for the end states.'It was CRANE. Enter for a new word'.textAlign is still 'center').In draw, under the grid loops, leave an empty line and write the six lines. Press Run.
Skills: Game states
← Winning and losing Where the keys go →