VOOZH about

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

⇱ JavaScript Object getOwnPropertyDescriptor() Method - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

JavaScript Object getOwnPropertyDescriptor() Method

Last Updated : 12 Jul, 2025

The Object.getOwnPropertyDescriptor() method in JavaScript is a standard built-in object that enables the full information on a property to be accessed and returns a property descriptor for the own property of a given object. 

Syntax: 

Object.getOwnPropertyDescriptor( obj, prop )

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

  • obj: This parameter holds the object in which the property is to be looked.
  • prop: This parameter holds the name or Symbol of the property whose description is to be retrieved.

Return value: This method returns a property descriptor of the given property or undefined depending upon the existence of the object.

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

Example 1: In this example, we will check if an object contains some property or not using the Object.getOwnPropertyDescriptor() method in JavaScript.

Output: 

true
true
"GeeksforGeeks"
"Best Platform"
true
"And Computer science portal"

Example 2: In this example, we will check if an object contains some property or not using the Object.getOwnPropertyDescriptor() method in JavaScript.

Output: 

Object { get: get foo() { return 17; }, set: undefined, enumerable: true, configurable: true }
Object { value: 42, writable: true, enumerable: true, configurable: true }
Object { value: 73, writable: true, enumerable: true, configurable: true }
Object { value: 8675309, writable: false, enumerable: false, configurable: false }

We have a complete list of Javascript Object methods, to check those please go through this JavaScript Object Complete Reference article.

Supported Browsers: The browsers supported by Object.getOwnPropertyDescriptor() method are listed below: 

  • Google Chrome 5.0 and above
  • Internet Explorer 9.0 and above
  • Mozilla 4.0 and above
  • Opera 12 and above
  • Safari 5.0 and above
Comment