➕dot notation (.)
`obj . prop` syntax.
obj . prop // `prop` must be an "identifier".Last updated
`obj . prop` syntax.
obj . prop // `prop` must be an "identifier".Last updated
// ⭐️ 1. prop: invalid identifier
// ------------------------------
undeclared.1 = 'bad'; // ⛔ SyntaxError: Unexpected number
// ^^
// ⭐️ 2. obj: "undeclared"
// -------------------------------
undeclared.prop; // ⛔ ReferenceError: 'undeclared' is not defined
// ⭐️ 3. obj: "nullish"
// -------------------------------
null.prop // ⛔ TypeError: Cannot read properties of null
// ⭐️ 4. obj: not "nullish"
// -------------------------------
(18).prop; // ❗ undefined (no such `prop`)
(18).toString(16); // ❓ "12" (property value, could be any value)
// object
let obj = {};
// ┌───────────────────┐
// │ valid identifiers │
// └───────────────────┘
obj.$1 = 'joe'; // ✅ can begin with $, _
obj.var = 'OK'; // ✅ reserved word is allowed❗