Object.definePropertiesadvanced// Define multiple property descriptors at once
const obj = {}
Object.defineProperties(obj, {
x: { value: 1, writable: true, enumerable: true },
y: { value: 2, writable: false, enumerable: true },
})Use Object.defineProperties() to define multiple properties with fine-grained descriptors in a single call.
When configurable: false, you cannot delete the property or redefine its descriptor.
Challenge: Implement addLocked(obj) that defines a locked property with configurable: false.
const o = {}
addLocked(o)
delete o.locked // silently fails
o.locked // β 42