Workshop › Rhythm Lanes › Step 9 of 35
draw now paints every note that is not hit yet and is on the screen: a 20-pixel block in its lane's color, centred
on noteY.
```js
for (const n of notes) {
if (n.hit) continue
const y = noteY(n)
if (y < -20 || y > canvas.height + 20) continue
ctx.fillStyle = COLORS[n.lane]
ctx.fillRect(LEFT + n.lane * LANE_W + 8, y - 10, LANE_W - 16, 20)
}
```for (const n of notes) repeats its body for every note, calling it n.continue skips to the next note: hit notes and notes off the screen are not drawn.|| means "or". The block is 20 pixels tall, centred on y, 8 pixels in from the lane's sides.In draw, under the lanes loop, write the notes loop (before the function's last }).
Skills: Loops, Drawing on a canvas
← The clock decides where A clock that ticks →