Skip to content
FLAVIO COPES
flaviocopes.com
2026

The Object getOwnPropertyDescriptor() method

By Flavio Copes

Learn how the JavaScript Object.getOwnPropertyDescriptor() method returns the descriptor of a property, with its value, writable, enumerable, and configurable.

~~~

This method can be used to retrieve the descriptor of a specific property.

Usage:

const propertyDescriptor = Object.getOwnPropertyDescriptor(object, propertyName)

Example:

const dog = {}
Object.defineProperties(dog, {
  breed: {
    value: 'Siberian Husky'
  }
})
Object.getOwnPropertyDescriptor(dog, 'breed')
/*
{
  value: 'Siberian Husky',
  writable: false,
  enumerable: false,
  configurable: false
}
*/
~~~

Related posts about js: