It seems like using objects here could be a bit more readable, and potentially even a smidge faster: http://jsperf.com/array-vs-object-lookup-table (don't format it like they do though, you probably want to put it all on one line).