Workshop › Wordle-style Word Guess › Step 4 of 26
A guess is five letters, so a row has five tiles. A for loop draws them, each SIZE + GAP pixels to the right of
the last, with the row centered. Empty tiles are only outlines.
```js
const SIZE = 56 // one letter tile
const GAP = 6
const LEFT = (canvas.width - 5 * SIZE - 4 * GAP) / 2
const TOP = 12
for (let i = 0; i < 5; i++) {
const x = LEFT + i * (SIZE + GAP)
const y = TOP
ctx.strokeStyle = '#3f3f46'
ctx.lineWidth = 2
ctx.strokeRect(x + 1, y + 1, SIZE - 2, SIZE - 2)
}
```LEFT is half of what is
left of the 360: 28.for (let i = 0; i < 5; i++) repeats with i = 0, 1, 2, 3, 4.i is i * (SIZE + GAP) to the right of LEFT.strokeRect draws only the border of a rectangle (fillRect fills it); strokeStyle and lineWidth pick its
colour and thickness. It is drawn 1 pixel inside the tile, so the 2-pixel border stays inside.const ctx = ..., leave an empty line and write the four size lines.draw, under the fillRect line, leave an empty line and write the loop. Press Run.Skills: Drawing on a canvas, Loops
← A function that draws Six rows →