Workshop › Snake › Step 23 of 28
The score is counted but never shown. We write it in the top-left corner on every frame.
```js
ctx.fillStyle = 'white'
ctx.font = '16px sans-serif'
ctx.textAlign = 'left'
ctx.fillText('Score: ' + score, 8, 20)
```'Score: ' + score joins text and a number: Score: 3.8, 20 is 8 pixels from the left, 20 from the top.fillStyle.for loop, leave an empty line and write the four score lines.ctx.fillStyle = 'white' inside the if (gameOver) block.Skills: Drawing on a canvas
← The game over message One function that starts a game →