Workshop › Hangman › Step 26 of 36
When the game is over, a message says so: green for a win, red for a loss, just above the word.
```js
function draw() {
// ...
if (state !== 'playing') {
ctx.font = 'bold 20px sans-serif'
ctx.fillStyle = state === 'won' ? '#15803d' : '#b91c1c'
ctx.fillText(state === 'won' ? 'You got it! Click for the next word' : 'Hanged! Click to try another', canvas.width / 2, 298)
}
```state === 'won' ? a : b picks the color and the text: green and "You got it!" for a win, red and "Hanged!" for a loss.In draw, under the if ... else block you wrote in the last step, write this block. Press Run and finish a word.
Skills: Game states
← Show the word you missed Play again →