You’ve probably heard of the Tron in 219 bytes which has the code:
<body id=b onkeyup=e=event onload= z=c.getContext('2d'); z.fillRect(s=0,0,n=150,x=11325); setInterval(" 0<x%n &x<n*n &(z[x+=[1,-n,-1,n][e.which&3]]^=1) ?z.clearRect(x%n,x/n,1,1,s++) :b.innerHTML='game⬜over:'+s ",9) ><canvas id=c>
The part of this I really like is:
[1,-n,-1,n][e.which&3]
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.)