A property can exist yet resist assignment, iteration, or deletion. Object.defineProperty() creates or redefines it through explicit descriptor attributes: writable controls value changes, enumerable controls visibility in for...in and Object.keys(), and configurable controls deletion and descriptor changes. section 5.2.3
A locked, visible serial number
Define serialNumber with writable: false, enumerable: true, and configurable: false. Deleting it fails, and a later Object.defineProperty() call cannot change its attributes, although the property remains directly readable. Strict mode throws on assignment to a non-writable property; sloppy mode silently fails. section 5.2.3
const drawer = {};
Object.defineProperty(drawer, 'serialNumber', {
value: 'SN-12345',
writable: false, #A
enumerable: true, #B
configurable: false, #C
});
delete drawer.serialNumber;
console.log(drawer.serialNumber); // #D
Object.defineProperty(drawer, 'serialNumber', {
writable: true, // #E
});Inspect the interaction between non-writable and non-configurable attributes through deletion and attempted redefinition. section 5.2.3


