Workshop › Battleship › Step 28 of 35
The H key turns the heat map on and off.
```js
document.addEventListener('keydown', (event) => {
if (event.key === 'h' || event.key === 'H') showHeat = !showHeat
else return
event.preventDefault()
})
```'h' || 'H' accepts both, with or without Caps Lock.!showHeat flips it.return right away; only keys the game uses reach preventDefault, so the page keeps its normal keys.Under the pointerdown listener, write the keydown listener.
Skills: Keyboard and mouse input
← See the heat map Show their ships at the end →