Workshop › Sudoku › Step 2 of 28
The board is divided into nine 3 × 3 boxes. Thin grey lines separate the cells and thick dark lines outline the boxes.
```js
// Thin lines between cells, thick ones around each box.
for (let i = 0; i <= 9; i++) {
ctx.fillStyle = i % 3 === 0 ? '#0f172a' : '#94a3b8'
const w = i % 3 === 0 ? 3 : 1
ctx.fillRect(LEFT + i * SIZE - w / 2, TOP, w, 9 * SIZE)
ctx.fillRect(LEFT, TOP + i * SIZE - w / 2, 9 * SIZE, w)
}
```i goes from 0 to 9: 10 lines each way (the edges included).i % 3 === 0 is true for lines 0, 3, 6 and 9, the box borders: dark and 3 pixels wide; the others are grey and 1 pixel.- w / 2).In draw, after the cells loop, write the comment and the lines loop.
Skills: Drawing on a canvas
← Nine by nine A puzzle from a string →