In Chrome, the following JavaScript code throws an Unexpected Token error:
var somearray = ["foo","bar"];
var someassoc = {somearray[0]:somearray[1]};
The error thrown:
Uncaught SyntaxError: Unexpected token [
When instead I would expect that it should make an object with a key of somearray[0] and an item of somearray[1] for that key.
So, why is this happening? An Unexpected Token normally means that a bracket has been misplaced somewhere, etc, but that is not the case here.