Workshop › Memory › Step 21 of 25
After a win, a click starts a new game instead of turning a card. newGame reshuffles, so the layout is never the same
twice.
```js
canvas.addEventListener('click', (event) => {
if (won()) {
newGame()
return
}
```newGame() deals a fresh board and return stops the click from also turning a card.At the top of the click listener, write the if (won()) block.
Skills: Keyboard and mouse input, Game states
← All pairs found A number that follows →