getOwnPropertyDescriptors < Object < JavaScript
The Object getOwnPropertyDescriptors() static method returns the property descriptors for all the properties of the given object.
const house = {
age: 42,
style: "Cap Code"
};
const houseObjOwnPropDescs = Object.getOwnPropertyDescriptors(house);
console.log(houseObjOwnPropDescs.age.value);
// 42
console.log(houseObjOwnPropDescs);
{
age: {
configurable: true,
enumerable: true,
value: 42,
writable: true
},
style: {
configurable: true,
enumerable: true,
value: "Cap Code",
writable: true
}
}