Object.getOwnPropertyDescriptorbeginner// Inspect a single property's descriptor
const obj = { x: 42 }
Object.getOwnPropertyDescriptor(obj, 'x')
// β { value: 42, writable: true, enumerable: true, configurable: true }Use Object.getOwnPropertyDescriptor() to retrieve the descriptor object that describes a property's attributes.
You can use the returned descriptor to check individual flags like enumerable and configurable.
Challenge: Implement isEnumerable(obj, key) that returns whether the own property key is enumerable.
isEnumerable({ a: 1 }, 'a') // β true (normal property)