Skip to content

keyCodes

Mike Byrne edited this page Jan 25, 2022 · 2 revisions

description

Abstraction of commonly used key codes.

NB: object not a function

requires

  • nothing

parameters

  • none

returns

  • nothing

example usage:

document.addEventListener('keydown', function(e) {
  if (e.keyCode == keyCodes.esc) {
    console.log('Escape key pressed');
  }
});

keycodes

  • tab
  • enter
  • esc
  • space
  • left
  • up
  • right
  • down