Workshop › Zelda-style Dungeon › Step 21 of 22
The fastest escape is kept in localStorage and shown next to the time. Here the best is the smallest number of frames.
```js
let best = Number(localStorage.getItem('dungeon-best')) || 0
if (best === 0 || frames < best) {
best = frames
localStorage.setItem('dungeon-best', best)
}
ctx.fillText('Time ' + seconds(frames) + (best ? ' Best ' + seconds(best) : ''), canvas.width - 12, 30)
```(best ? ... : '') adds the best time only when there is one.held, write best.Skills: Game states
← The stairs out Build it yourself: cleared rooms →