Workshop › 15 Puzzle › Step 9 of 27
forEach goes through the board: every number is drawn on its square, except the gap.
```js
tiles.forEach((number, i) => {
if (number === 0) return
drawTile(number, squareX(i), squareY(i))
})
```forEach runs the function once per item: number is the tile, i its position.if (number === 0) return skips the gap: return ends this turn only.In draw, replace the drawTile(1, ...) line with the forEach block. Press Run.
Skills: Arrays and objects, Loops
← The number on the tile Draw again and again →