|XP is just a number|
Re^3: Outputting JSON with sorted names/keys (JS Object vs Perl hash / updated)by LanX (Cardinal)
|on Jan 27, 2020 at 12:37 UTC||Need Help??|
> An object is an unordered set of name/value pairs.
To make it worse, I'm pretty sure that in JS this "object" should be written capitalized as "Object".
"Object" is the base "object" instance in JS from which all other objects inherit°, including the objects Array and Function. A literal "Object" is written with key value pairs surrounded by curlies. "object" is a type.
From a Perl perspective objects are best understood as tied hashes which lookup missing keys via the "prototype" chain (exposed in FF thru __proto__ ).
I'm starting to agree that Crockford should have avoided the term "object" in his JSON definition...
Demo from the FF console (please note that __proto__ is not necessarily available in other dialects)
°) seems like newer ECMA versions allow the creation of objects without prototype. This would actually be very close to a Perl hash.