Workshop › Klondike Solitaire › Step 34 of 40
The game is won when all four foundations hold 13 cards. Only a move onto a foundation can win, so tryMove simply checks
after every move.
```js
let won
won = false
function checkWin() {
if (['f0', 'f1', 'f2', 'f3'].every((f) => piles[f].length === 13)) {
won = true
}
}
checkWin()
```every is some's partner: true only if the function is true for every item.checkWin is called in tryMove after each move.let frames write let won; in deal, under frames = 0, write won = false.autoMove, leave an empty line and write checkWin.tryMove, call checkWin() between moves += 1 and return true.Skills: Game states