Workshop › Wordle-style Word Guess › Step 9 of 26

Show the letters

What we are doing

The typed letters go into the first row, big and upper case, centered in their tiles. A tile with a letter gets a brighter outline.

```js
ctx.textAlign = 'center'
ctx.textBaseline = 'middle'

for (let row = 0; row < TRIES; row++) {
  const letters = row === 0 ? current : ''

    ctx.strokeStyle = letters[i] ? '#a1a1aa' : '#3f3f46'

    if (letters[i]) {
      ctx.fillStyle = 'white'
      ctx.font = 'bold 28px sans-serif'
      ctx.fillText(letters[i].toUpperCase(), x + SIZE / 2, y + SIZE / 2 + 1)
    }
```

What it means

Your turn

  1. In draw, under the fillRect line, write the two text settings (no empty line between).
  2. Under the row loop's first line, write const letters ....
  3. Change the strokeStyle line, and under strokeRect write the if (letters[i]) block. Press Run and type.

Skills: Drawing on a canvas

All steps

  1. The canvas and the pen
  2. Paint the background
  3. A function that draws
  4. A row of five tiles
  5. Six rows
  6. Draw again and again
  7. The typed letters
  8. Type with the keyboard
  9. Show the letters
  10. Backspace
  11. Leave shortcuts alone
  12. A secret word
  13. Right letter, right place
  14. Right letter, wrong place
  15. Enter sends the guess
  16. Colour the guesses
  17. Winning and losing
  18. A message line
  19. Where the keys go
  20. Draw the keyboard
  21. Tap a key
  22. Enter and Delete keys
  23. Keys that remember
  24. Keep statistics
  25. Show the statistics
  26. Build it yourself: only real words