I am learning javascript myself. There is confusion with some javascript,
price = 14; name = "Mary"; apples:5; //This line executing without error "orranges":6; //This line getting error alert(name);
Both of these lines can be used in a json object without any errors. But when I use these lines outside the json object, the second line appears ( "orranges": 6; ). Why is this? And why doesn't it give an error for the first line ( Apples: 5; ), is there a way I can use it outside of the json object?
source share