Object.getOwnPropertyDescriptorsintermediate// Inspect all property descriptors at once
const obj = { a: 1, b: 2 }
Object.getOwnPropertyDescriptors(obj)
// β { a: { value: 1, writable: true, ... }, b: { value: 2, ... } }Use Object.getOwnPropertyDescriptors() to get all property descriptors of an object, useful when doing a complete clone.
Object.getOwnPropertyDescriptors returns only string-keyed own properties. Symbol-keyed properties are excluded (use Object.getOwnPropertySymbols for those).
Challenge: Implement hasNoSymbol(obj) that returns true if the descriptors map does not include Symbol keys.
const s = Symbol('test')
hasNoSymbol({ [s]: 1 }) // β true (Symbol not in descriptors)