Workshop › Memory › Step 18 of 25
A move is two cards turned over. We count moves in moves: zero in a new game, one more each time the second card of
a turn is opened.
```js
let moves
moves = 0
if (opened.length < 2) return
moves += 1
```moves starts at 0 in newGame.moves += 1 sits right after the "wait for the second card" line, so it counts once per pair of cards.let opened, write let moves.newGame, under opened = [], write moves = 0.flip, under the empty line after if (opened.length < 2) return, write moves += 1.Skills: Game states
← Pair or no pair Show moves and pairs →