Shadowing occurs when an object gains an own data property whose name matches an inherited property. Property lookup stops at the nearer property, so the own value takes precedence while the prototype remains unchanged. section 5.3.1
An inherited label becomes local
With drawerPrototype.label set to "default", drawer initially reads that inherited value. After drawer.label = "tax documents", reads return the new own value, while drawerPrototype.label remains "default". This rule applies to data properties; an inherited setter instead runs with this bound to drawer and commonly creates drawer._label. section 5.3.1
const drawerPrototype = { label: 'default' };
const drawer = Object.create(drawerPrototype);
console.log(drawer.label); #A
drawer.label = 'tax documents';
console.log(drawer.label); #B
console.log(drawerPrototype.label); #ATrace the before-and-after lookup behavior with a prototype-backed drawer and observe that assignment shadows rather than mutates the prototype. section 5.3.1
Use these distinctions when diagnosing surprising property behavior:
- Reads traverse the prototype chain; writes create an own property or invoke an inherited setter. section 5.3.1
- Inherited names can affect authorization and configuration, so distinguish own properties from prototype-provided values. section 5.3.1




