JavaScript Object getOwnPropertyDescriptors()

The JavaScript Object.getOwnPropertyDescriptors() method returns all own property descriptors of a given object.

The syntax of the getOwnPropertyDescriptors() method is:


The getOwnPropertyDescriptors() method, being a static method, is called using the Object class name.

getOwnPropertyDescriptors() Parameters

The getOwnPropertyDescriptors() method takes in:

  • obj - The object for which to get all own property descriptors.

Return value from getOwnPropertyDescriptors()

  • Returns an object containing all own property descriptors of an object

Example: Using getOwnPropertyDescriptors()

let obj = {
  x: 10,
  get number() {
    return this.x;

let value = Object.getOwnPropertyDescriptors(obj);

// getOwnPropertyDescriptors() can be used for shallow clone
let cloneObj = Object.create(

console.log(cloneObj); // { x: 10, number: [Getter] }


  x: { value: 10, writable: true, enumerable: true, configurable: true },
  number: {
    get: [Function: get number],
    set: undefined,
    enumerable: true,
    configurable: true
{ x: 10, number: [Getter] }

Recommended Reading: Javascript Object.getOwnPropertyDescriptor()

Did you find this article helpful?