I’m newbie in JS (also in any programming language) BUT. I’ve read Stack Overflow about the difference between JSON and JS objects. And as for me “collection” is more like javascript object than JSON. Also, as i’ve understand JSON is textual format. and all JSON keys have to be enclosed in double quotes. Also, method PUSH, SHIFT etc won’t work (cause there are strings not arrays). Am i right?
And I’m sorry for my terrible English )))
I thin you are confusing things… JSON and JS objects are exactly the same thing!
JSON stands for JavaScript Object Notation or in a simple slang JS Objects LOL
And you are right when you say that array methods won’t work in JS objects because they are for arrays not objects… In the beggining I was confusing the differences between arrays and objects aswell…
not exactly, some JSON doesn’t compile to JS, and vice-versa.
Here is a thread explaining everything: What are the differences between JSON and JavaScript object? - Stack Overflow
Generally it’s safe to assume that a javascript object can be parsed to JSON and vice-versa, but it’s not always the case if you don’t have a parser.
Hmm thanks for the link… Always learning xD
So a JSON is always a JS object but a JS object not always is a valid JSON… Interesting…