Home » Javascript Object getOwnPropertyDescriptor() Method

Javascript Object getOwnPropertyDescriptor() Method

by Online Tutorials Library

JavaScript Object.getOwnPropertyDescriptor() Method

The Object.getOwnPropertyDescriptor method allows to query the full information about a property and returns a property descriptor for an own property (that is, one directly present on an object and not in the object’s prototype chain) of a given object.

Syntax:

Parameter

obj: It is the object in which to look for the property.

Prop: It is the name of the property whose description is to be retrieved.

Return value:

It returns a property descriptor of the given property if it exists on the object.

Browser Support:

Chrome 4
Edge Yes
Firefox 12
Opera 4

Example 1

Output:

true  true  42  34  

Example 2

Output:

true  true  42  

Example 3

Output:

true  56  

Next TopicJavaScript Objects

You may also like