Workshop › 15 Puzzle › Step 4 of 27
The picture will change after every slide, so it will be drawn again and again. We put the drawing lines in a
function named draw, and call it after reset().
```js
function draw() {
ctx.fillStyle = '#292524'
ctx.fillRect(0, 0, canvas.width, canvas.height)
}
reset()
draw()
```function draw() { ... } defines the recipe; it does not run yet.draw() under reset() runs it once the board is ready.Wrap the two drawing lines in function draw() { ... } and write draw() under the reset() call at the bottom.
Skills: Functions
← Paint the table Row and column →