Workshop › OutRun-style Racer › Step 34 of 44
A race has laps. Every time position wraps past the end of the track, a lap is complete. We count them in lap,
which starts at 1.
```js
let lap
lap = 1
if (position >= trackLength) {
position -= trackLength
lap += 1
}
```reset sets lap to 1.if becomes a block with { } so it can do more than one thing: wrap the position and count the lap.let cars write let lap.reset, under speed = 0, write lap = 1.update, turn the one-line if into the block.Skills: Game states
← Rear-end crash Show the lap →