I am learning javascript myself. There is a confusion with some javascript,
price = 14;
name = "Mary";
apples:5; //This line executing without error
"orranges":6; //This line getting error
alert(name);
Those both lines can be used into a json object without any error. But when I am using those lines outside of json object, 2nd line ("orranges":6;) is getting error. Why is that ? And why is not giving error for the first line (apples:5;), is there any way that I can use it outside of json object ?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…