The objGetOwnPropertyDescriptor() method returns an object describing the configuration of a specific property on
a given object (that is, one directly present on an object and not in the object's prototype chain). The object
returned is mutable but mutating it has no effect on the original property's configuration.
Since
0.4.3
Example
o = {}; objDefineProp(o, 'qux', { value:8675309, writable:false, enumerable:false }); d = objGetOwnPropertyDescriptor(o, 'qux'); // d is { // value: 8675309, // writable: false, // enumerable: false, // configurable: false // }
objGetOwnPropertyDescriptor('foo', 0); // TypeError: "foo" is not an object // ES5 code
Note: In ES5, if the first argument to this method is not an object (a primitive), then it will cause a TypeError. In ES2015, a non-object first argument will be coerced to an object at first.
The objGetOwnPropertyDescriptor() method returns an object describing the configuration of a specific property on a given object (that is, one directly present on an object and not in the object's prototype chain). The object returned is mutable but mutating it has no effect on the original property's configuration.
Since
0.4.3
Example
Note: In ES5, if the first argument to this method is not an object (a primitive), then it will cause a TypeError. In ES2015, a non-object first argument will be coerced to an object at first.