# keydown Event

*noun*

say it: **“KEE-down ih-VENT”** **/ˈkiːdaʊn ɪˈvɛnt/**

The event a page fires the moment a key is pressed down, before it is let go; its key property says which key it was.

## What is **keydown Event** in JavaScript?

**keydown Event** — The event the page fires the moment a key is pressed down. The event object's `key` property names the key, such as `'Enter'`, `'Escape'` or `'ArrowRight'`, so one listener can react to each key differently.

```javascript
document.addEventListener('keydown', (event) => {
  if (event.key === 'Escape') {
    console.log('Close the recipe card');
  }
});
```

## In a sentence

- “I listened for the **keydown** event so that pressing Escape closes the recipe card.”
- “On each **keydown event**, the game checks event.key and moves the player left for ArrowLeft.”

Level: Apprentice · [More JavaScript terms at this level](https://www.ask-codey.com/glossary?category=javascript&level=2)

Updated: November 9, 2026

Source: https://www.ask-codey.com/glossary/keydown-event
