Workshop › Simon Says Colors › Step 21 of 27
A new game means an empty sequence, no light, and a first round. We collect that in one function, reset, and the
first game starts through it too.
```js
let sequence // the pads to repeat, growing by one every round
let lit // the pad lit right now, or -1
let litFor
function reset() {
sequence = []
lit = -1
litFor = 0
nextRound()
}
reset()
requestAnimationFrame(loop)
```sequence, lit and litFor are now only declared; reset gives them their values.reset ends with nextRound(), which adds the first pad and starts the show.reset() at the bottom replaces the old nextRound() call.let sequence, let lit and let litFor (keep the comments).let litFor, leave an empty line and write reset.nextRound() with reset().Skills: Game states, Functions
← Progress and mistakes Click to retry →