🍄object
reference types
an unordered collection of properties (name : value pairs).
// creating objects
{name: value} // object literal
new Object() // `new` statement
let obj = Object.create(prototype) // specify an object's prototype🈯 synonyms: "hash", "hashtable", "dictionary", "associated array".
Object.assign() - copies properties from other objects.
serializing objects - convert/restore object's state to/from string.
.toString() / .toLacaleString() - object -> string.
.valueOf() - object -> primitive (typically a number)
.toJSON() - a method expected by JSON.stringify()
use optional chaining (?., ?.[]) to safely acess object's members.
event handler can be an object.
the import in import.meta is NOT an object❗️
JS object is associated array.
Last updated
Was this helpful?