JS: Object Literal Expression SyntaxError: Unexpected token colon
Syntaxerror: unexpected token :
if you type
{ a: 7, b: 8 }
you may get a syntax error about unexpected token colon.
SyntaxError: Unexpected token :
That is because JavaScript confused object literal with statement block syntax. Due to bad design of JavaScript.
Solution
solution is to add a paren:
({ a: 7, b: 8 })