Skip to main content
CSS is fun and cool and I like it.
Article

Review of My New Computer Equipment

I recently changed out just about all of my computer equipment. Nothing dramatic like #davegoeswindows, but all new gear within my relative comfort-zone. It was the first time since late 2013, and now it's going on 2017, so I figured it was time.

No surprise: I'm an Apple guy. I have been for a couple of decades now. I was pretty excited about the new MacBook Pro's and ordered one within a few days of them coming out. Coinciding … Read article

Snippet

KeyboardEvent Value (keyCodes, metaKey, etc)

When a KeyboardEvent fires, you can test which key was pressed because that event contains information you can write logic against.

document.addEventListener("keydown", function(event) {
  console.log(event.which);
})

For example, by pressing "a", you'll get 65. Apparently it's best to write logic against which, as keyCode and charCode are complicated:

The event.which property normalizes event.keyCode and event.charCode. It is recommended to watch event.which for keyboard key input.

And:

In a keypress event, the Unicode value of the key pressed is

Read article
icon-link icon-logo-star icon-search icon-star