key

A String system variable that contains the value of the last key typed.

The key variable is helpful for checking whether an ASCII key has been typed. For example, the expression key === "a" evaluates to true if the a key was typed and false if not. key doesn’t update for special keys such as LEFT_ARROW and ENTER. Use keyCode instead for special keys. The keyIsDown() function should be used to check for multiple different key presses at the same time.

Examples

Notice any errors or typos? Please let us know. Please feel free to edit src/events/keyboard.js and open a pull request!

Related References