JavaScript Object literal notation confusion
Posted
by Ding
on Stack Overflow
See other posts from Stack Overflow
or by Ding
Published on 2010-05-05T16:37:03Z
Indexed on
2010/05/05
16:38 UTC
Read the original article
Hit count: 246
JavaScript
|JSON
In Firefox console, this code will generate error:
{"d" : ["bankaccountnumber", "$1234.56"] }
SyntaxError: invalid label { message="invalid label", more...}
this code works just fine
{d : ["bankaccountnumber", "$1234.56"] }
["bankaccountnumber", "$1234.56"]
this code works fine as well
var act = {'d' : ["bankaccountnumber", "$1234.56"] }
a.d
Can someone help to explain why is the diference? thanks!
© Stack Overflow or respective owner