Object.getOwnPropertyDescriptor() (ok)
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyDescriptor
const object1 = {
property1: 42
};
const descriptor1 = Object.getOwnPropertyDescriptor(object1, 'property1');
console.log(descriptor1.configurable);
// expected output: true
console.log(descriptor1.value);
// expected output: 42Object.getOwnPropertyDescriptor(obj, prop)
obj
The object in which to look for the property.
prop
The name or Symbol of the property whose description is to be retrieved.Description
Examples
Using Object.getOwnPropertyDescriptor
Previous[TYPESCRIPT] A practical guide to TypeScript decorators exmaple (ok)NextJavaScript — Property Descriptor && PropertyDescriptor (ok)
Last updated