JS: Object.getOwnPropertyDescriptor ❌
Object.getOwnPropertyDescriptor(obj, key)-
- Return the Property Descriptor of key of object obj.
- If the property doesn't exist, return undefined.
- If obj is not a object, it is first converted to a object type.
🟢 TIP: better is Reflect.getOwnPropertyDescriptor
// get the attributes of a property console.log(Object.getOwnPropertyDescriptor({ "p": 4 }, "p")); // { value: 4, writable: true, enumerable: true, configurable: true }
JavaScript. Define Properties and attributes.
- JS: Property Attributes
- JS: Enumerable Property
- JS: Property Descriptor
- JS: Object.create
- JS: Object.defineProperty ❌
- JS: Reflect.defineProperty
- JS: Object.defineProperties
- JS: Object.prototype.propertyIsEnumerable ❌
- JS: Object.getOwnPropertyDescriptor ❌
- JS: Reflect.getOwnPropertyDescriptor
- JS: Object.getOwnPropertyDescriptors