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
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 typed.
keyIsDown
Returns true if the key it’s checking is pressed and false if not.
keyIsPressed
A Boolean system variable that's true if any key is currently pressed and false if not.