Workshop › Wordle-style Word Guess › Step 3 of 26
The picture will change with every letter you type, so it will be drawn again and again. We put the drawing lines in
a function named draw; one call, draw(), repaints everything.
```js
function draw() {
ctx.fillStyle = '#18181b'
ctx.fillRect(0, 0, canvas.width, canvas.height)
}
draw()
```function draw() { ... } defines the recipe; it does not run yet.{ and } are its body, indented by two spaces.draw() with parentheses runs it.Wrap the two drawing lines in function draw() { ... } (indented by two spaces) and call draw() after it.
Skills: Functions
← Paint the background A row of five tiles →