Workshop › Pong › Step 4 of 26
A for loop repeats the dash every 30 pixels from the top to the bottom: 15 pixels of dash, 15 of gap.
```js
for (let y = 0; y < canvas.height; y += 30) {
ctx.fillRect(canvas.width / 2 - 2, y, 4, 15)
}
```let y = 0 starts a counter at 0; y < canvas.height keeps going while it is above the bottom; y += 30 adds 30
after each round.Replace the dash line with the loop (the fillRect inside uses y). Press Run.
Skills: Loops
← One dash of the net Two paddles →