Workshop › Battleship › Step 33 of 35
In Battleship fewer shots is better. The best win is saved in localStorage.
```js
let best = Number(localStorage.getItem('battleship-best')) || 0
if (best === 0 || shots < best) {
best = shots
localStorage.setItem('battleship-best', best)
}
```best is read from the browser's storage (0 when there is none yet).best === 0) or it took fewer shots.let cursor, write the best line.playerShoots, save the record right above the return of the winning block.Skills: Game states
← Fire with Enter, play again A side panel →