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
Related References
code
The code property represents a physical key on the keyboard (as opposed to the character generated by pressing the key).
key
A String system variable that contains the value of the last key typed.
keyCode
A Number system variable that contains the code of the last key pressed.
keyIsDown
Returns true if the key it’s checking is pressed and false if not.