Press any key to see what JavaScript gets for it: event.key, event.code, the old keyCode, which side of the keyboard it was on, any modifiers, and a line of code to check for it.
| Use | For |
|---|---|
event.key | what the key means: "a", "A", "Enter", "ArrowUp". Changes with Shift and the keyboard layout. |
event.code | where the key is: "KeyA" is the same key on QWERTY and AZERTY. Best for game controls (WASD). |
event.keyCode | an old number, deprecated; avoid it in new code. |
Some keys never reach a web page: the system takes them (such as the Fn key, or Cmd+Tab).
Which copy of a key it was: left or right Shift, Ctrl and Alt, or the number pad.
Open all 35 Dev Tools. Everything runs in your browser; nothing you paste is uploaded.