Workshop › Rhythm Lanes › Step 17 of 35
When you hold a key down, the computer repeats the keydown event many times a second. In a rhythm game one press
must be one hit, so repeated events are ignored.
```js
document.addEventListener('keydown', (event) => {
if (event.repeat) return // holding a key down is not a new press
```event.repeat is true for the repeated events of a held key; we return before doing anything.Write the line at the top of the keydown listener.
Skills: Keyboard and mouse input
← Close enough in time A message on the screen →