JavaScript array indexing technique

You’ve probably heard of the Tron in 219 bytes which has the code:

<body id=b onkeyup=e=event onload=
><canvas id=c>

The part of this I really like is:


Because e.which&3 reduces the keystrokes (i, j, k, l) to an array index that is 0-3. That index then selects a value in the moves array: [1, -n, 1, n]. I’m thinking I’ll use this trick to say index into a set of stored numbers or something, even objects:

error_code = {
  "e100": "Error 1",
  "e200": "Error 2",
  "e300": "Some other error"
}['e' + code_number]

(You can’t begin a hash key with a number.)