Javatpoint Logo
Javatpoint Logo

JavaScript Reflect.getOwnPropertyDescriptor() Method

The static Reflect.getOwnPropertyDescriptor() method is used to retrieve the descriptor of an object's property. It is same as the Object.getOwnPropertyDescriptor method.

Syntax:

Parameters:

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

Key: It is the name of the property to get an own property descriptor for.

Return value:

It returns the property descriptor object if the property exists in the given target object. Otherwise, it returns undefined.

Exceptions:

A TypeError, if the target is not an Object.

Browser Support:

Chrome 49
Edge 12
Firefox 42
Opera 36

Example 1

Output:

undefined
 true

Example 2

Output:

234
Undefined
true
true

Example 3

Output:

42
undefined
true 
Next TopicJavaScript Reflect




Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials