VOOZH about

URL: https://www.geeksforgeeks.org/javascript/javascript-handler-getownpropertydescriptor-method/

⇱ JavaScript Handler getOwnPropertyDescriptor() Method - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

JavaScript Handler getOwnPropertyDescriptor() Method

Last Updated : 12 Jul, 2025

JavaScript handler.getOwnPropertyDescriptor() method in Javascript is a trap for the Object.getOwnPropertyDescriptor() method. A property cannot be reported as non-existent if it exists as a non-configurable own property of the target object.

Syntax:

const p = new Proxy(target, {
 getOwnPropertyDescriptor: function(target, prop) {
 }
});

Parameters: This method accepts two parameters as mentioned above and described below: 

  • Target: This parameter is the target object.
  • Prop: This parameter is the name of the property whose description should be retrieved.

Return value: This method returns an object or undefined.

Below examples illustrate the handler.getOwnPropertyDescriptor() method in JavaScript:

Example 1: In this example, we will see the use of handler.getOwnPropertyDescriptor() method in JavaScript.


Output
Type : num
5
Type : bool
true

Example 2: In this example, we will see the use of handler.getOwnPropertyDescriptor() method in JavaScript.


Output
Property : VAL
10
undefined

Supported Browsers:

The browsers are supported by handler.getOwnPropertyDescriptor() method is listed below: 

  • Google Chrome 49 and above
  • Edge 12 and above
  • Firefox 18  and above
  • Opera 36 and above
  • Safari 10 and above

We have a complete list of Javascript Proxy/handler methods, to check those go through the Javascript Proxy/handler Reference article.

Comment