Workshop › Breakout › Step 33 of 39
Starting a game means: build the wall, refill the lives, zero the score, serve. We collect all of it in newGame()
and use it at startup.
```js
let lives
let score
function newGame() {
buildBricks()
lives = 3
score = 0
resetBall()
}
newGame()
requestAnimationFrame(loop)
```lives and score are declared without values; newGame() sets them.newGame calls buildBricks, which is written further down. That is fine: what matters is that every function is
defined by the time newGame() actually runs, at the bottom.newGame() replaces the separate buildBricks() and resetBall() calls.= 3 from let lives and = 0 from let score.clamp and write newGame.buildBricks() and resetBall() with newGame().Skills: Functions, Game states