Understanding KeyboardEvent Values
event.key describes the character or named key produced by the input. Use it when the meaning of the key matters, such as Enter, Escape, or a typed letter.
event.code describes the physical keyboard position. It is useful for layout-independent controls such as games. event.keyCode and event.which are deprecated numeric values shown here for debugging older code.
The live viewer also exposes event type, location, repeat status, and modifier keys. Switch between keydown and keyup, compare recent events, or copy the current snapshot as JSON.