Lesson content
Read, practise, then check your understanding
Objects map string or symbol keys to property descriptors. Dot notation suits fixed identifiers; bracket notation accepts computed keys.
Behavior and inheritance
const accountPrototype = {
deposit(amount) { this.balance += amount; }
};
const account = Object.create(accountPrototype);
Object.assign(account, { owner: "Mira", balance: 100 });
account.deposit(50);
Lookup follows the prototype chain. Use Object.hasOwn when inherited properties must not count. Spread and Object.assign make shallow copies and do not preserve all descriptors or prototypes. Getters/setters expose computed access but can hide work. freeze prevents top-level mutation, not deep mutation. Prefer data with clear ownership and avoid modifying built-in prototypes.
Knowledge check
Answer every question correctly to complete this chapter.
0 of 10 checks passed
Your progress is saved on this device.