Workshop › Pong › Step 19 of 26
A match ends when a player reaches 5 points. The game keeps a state: 'playing' or 'over'; when it is over,
nothing moves.
```js
const WIN_SCORE = 5
let state = 'playing' // 'playing' or 'over'
if (winner.score >= WIN_SCORE) {
state = 'over'
return
}
function update() {
if (state !== 'playing') return
```WIN_SCORE names the target once.point, reaching it ends the game and return skips the serve.update does nothing unless the game is being played.BALL, write WIN_SCORE; under let ball, write let state.point, write the check under winner.score += 1.if (state !== 'playing') return the first line of update.Skills: Game states