I have confusion about what exactly people mean by Object Literals, JSON, JavaScript Objects, to me they seem similar:
{foo: 'bar', bar : 'baz'}
AFAIK, above is object literal, json as well as javascript object, isn’t it?
Does object literal and json mean the same thing ?
How do you guys differentiate which is what?
JSON is a just a data format, like XML. True JSON should have the keys surrounded by double quotes, like so:
JavaScript Objects are part of the JavaScript language, and have associated things such as a prototype.
Object literals is creating a javascript object in place with brackets as opposed to using the
newkeyword, orObject.create().