Object.getOwnPropertyDescriptors() static method returns all own property descriptors of a given object.
syntax ↴
Object.getOwnPropertyDescriptors(obj) ↴
obj The object for which to get all own property descriptors.
Object.getOwnPropertyDescriptors() method permits examination of the precise description of all own properties of an object. A property in JavaScript consists of either a string-valued name or a Symbol and a property descriptor.
Object.getOwnPropertyDescriptors() method returns an object containing all own property descriptors of an object.
A property in JavaScript consists of either a string-valued name or a Symbol and a property descriptor.
A property descriptor is a record with some of the following attributes ↴
value: the value associated with the property (data descriptors only).
writable: set to true if and only if the value associated with the property may be changed (data descriptors only).
configurable: set to true if and only if the type of this property descriptor may be changed and if the property may be deleted from the corresponding object.
enumerable: set to true if and only if this property shows up during enumeration of the properties on the corresponding object.
get: function which serves as a getter for the property, or undefined if there is no getter (accessor descriptors only).
set: function which serves as a setter for the property, or undefined if there is no setter (accessor descriptors only).
getOwnPropertyDescriptors() ignores symbolic properties, while getOwnPropertyDescriptor() does not ignore symbolic properties.
Object.getOwnPropertyDescriptors(myObject)