I believe the issue is that the code gets parsed as a function expression that is being indexed by a series of strings in comma expressions. This happens instead of automatic semicolon insertion jumping in and then giving you the "expected" code.
As a brief aside, TypeScript could help catch this sort of thing with its `--noImplicitAny` flag turned on.