If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Main content

Course: Unlisted resources area > Unit 2

Lesson 1: ProcessingJS documentation

key

A global variable that contains information about the most recently pressed key. You can print it out with the text() command to see the nice human-readable version, or you can query key.code for the numeric value of the key.
See a list of key codes here.
If you'd like to check whether one of the "special" keys were pressed, like arrows, you can also use keyCode.

Want to join the conversation?

No posts yet.