object#
Everything not primitive is an object. Plain objects are unordered (insertion-ordered for string keys in practice) key-value containers; keys are strings or symbols.
Object literal with two properties.
const obj = {name: "rk", port: 8080};
Dot access for a known key.
obj.name; // "rk"
Bracket access with a string key.
obj["port"]; // 8080
Bracket access with a computed key.
const k = "name";
obj[k]; // "rk"
Symbol keys are invisible to for...in and JSON.stringify.
const sym = Symbol("token");
obj[sym] = "secret";
Arrays are objects with integer keys plus .length; their
prototype carries iteration helpers (map, filter,
reduce, find, flat). See Data Structures.
Functions are objects too; typeof fn === "function" is the
historic exception.
typeof (() => {}); // "function"
References#
Data Structures for
Array,Map,Set,WeakMap,TypedArray.OOP for classes and prototypes.
symbol for symbol-keyed properties.