key vs code
event.keyis the character or name produced (layout-dependent): "a", "A", "Ä", "Enter".event.codeis the physical key position (layout-independent): "KeyA", "Digit1", "ShiftLeft" — use it for game controls.keyCodeandwhichare deprecated but still common in old code.
Frequently asked questions
What is the keycode for Space?
key " ", code "Space", keyCode 32.
What is the keycode for Escape?
key "Escape", keyCode 27.
Does it log my keystrokes?
No, events stay on this page and are not sent anywhere.

