Possible Duplicate:
What is the difference between object keys with quotes and without quotes?
What is the difference between a and b as below?
var a = {foo : "bar"};
var b = {"foo" : "bar"};
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There is no difference.
A key in an object literal can be an identifier or a string literal. You can use characters in a string that you can’t use in an identifier, but
foodoesn’t contain any of those.(As an aside, if you were writing JSON rather than JS, then the key would have to be a string)