Workshop › Sokoban › Step 26 of 29
R restarts the level: loadLevel(level) rebuilds the current level from its text. The hint line now lists the keys.
```js
document.addEventListener('keydown', (event) => {
// ...
if (event.key.toLowerCase() === 'r') loadLevel(level)
ctx.fillText('Arrows: move Z: undo R: restart', canvas.width / 2, canvas.height - 16)
```loadLevel(level) loads the level we are on, from scratch.z line, write the r line.draw, change the hint text. Press Run.Skills: Keyboard and mouse input
← Undo A record for every level →