JavaScript Reflect.getOwnPropertyDescriptor() Method

Beginner
6 min read
Updated: Nov 2026
3 examples
Static method

Definition

Reflect.getOwnPropertyDescriptor(target, propertyKey) returns a descriptor: a small object that describes one property. It tells you the value and three flags: writable (can it be changed?), enumerable (is it listed in loops?) and configurable (can it be deleted or redefined?).

Only own properties are described, not the ones from the prototype. If the property does not exist, you get undefined. For a getter or setter, the descriptor has get and set instead of value and writable.

Remember
Reflect.getOwnPropertyDescriptor(target, key)

data property     → { value, writable, enumerable, configurable }
accessor property → { get, set, enumerable, configurable }
not an own property → undefined

target must be an object, or TypeError

Syntax

Pass an object and a property name. Read the flags from the returned descriptor.

JavaScript
const user = { name: "Ann" };

const desc = Reflect.getOwnPropertyDescriptor(user, "name");

console.log(desc.value);          // Ann
console.log(desc.writable);       // true
console.log(desc.configurable);   // true
CallWhat it does
Reflect.getOwnPropertyDescriptor(obj, "a")The descriptor of the own property a, or undefined.
Reflect.getOwnPropertyDescriptor(obj, "a")?.writableRead one flag safely, even when the property is missing.
Reflect.defineProperty(obj, "a", desc)Use a descriptor to create or change a property.
Object.getOwnPropertyDescriptor(obj, "a")The older version. It also accepts primitives.

A standard JavaScript static method (ES2015) of the Reflect object: call it as Reflect.getOwnPropertyDescriptor(). No import required. Siblings: Reflect.apply(), Reflect.construct(), Reflect.defineProperty(), Reflect.deleteProperty(), Reflect.get(), Reflect.getPrototypeOf(), Reflect.has(), Reflect.isExtensible(), Reflect.ownKeys(), Reflect.preventExtensions(), Reflect.set(), Reflect.setPrototypeOf().

Library declarations
JavaScript
// ECMAScript 2015 (ES6)
Reflect.getOwnPropertyDescriptor(target, propertyKey)

// target      : an object
// propertyKey : a string or a symbol
// returns     : a descriptor object, or undefined
// throws      : TypeError if target is not an object

Parameters

ParameterDescription
targetRequired. The object to look at. If it is not an object, a TypeError is thrown.
propertyKeyRequired. The name of the property: a string or a symbol.

Return Value

Return ValueDescription
Descriptor objectFor a data property: value, writable, enumerable, configurable. For a getter or setter: get, set, enumerable, configurable.
undefinedThe object has no own property with that key.
TypeError (thrown)target is not an object.

JavaScript Examples

Example 1 — Look at a Normal Property

Print the descriptor of a plain property as JSON, and read single parts of it.

JavaScript
const user = { name: "Ann" };

const desc = Reflect.getOwnPropertyDescriptor(user, "name");

console.log("Descriptor: " + JSON.stringify(desc));
console.log("Value: " + desc.value);
console.log("Missing property: " + Reflect.getOwnPropertyDescriptor(user, "age"));
console.log("Array length: " + JSON.stringify(Reflect.getOwnPropertyDescriptor([1, 2], "length")));
Try It Yourself

How It Works

  1. All flags are true. A property created by normal assignment or in an object literal is writable, enumerable and configurable.
  2. Missing means undefined. There is no age property, so no descriptor exists.
  3. Built-in properties differ. An array's length can be changed, but it is hidden from loops and cannot be deleted.

Example 2 — Getters and Frozen Objects

A getter has get and set in its descriptor. A frozen object has all flags turned off.

JavaScript
const circle = {
  radius: 2,
  get diameter() {
    return this.radius * 2;
  }
};

const getter = Reflect.getOwnPropertyDescriptor(circle, "diameter");
console.log("get is a function: " + (typeof getter.get));
console.log("set is: " + getter.set);
console.log("Has a value key: " + ("value" in getter));

const frozen = Object.freeze({ id: 1 });
const flags = Reflect.getOwnPropertyDescriptor(frozen, "id");
console.log("Frozen: " + JSON.stringify(flags));
Try It Yourself

How It Works

  1. A getter has no value. The descriptor has get (a function) and set (here undefined, because there is no setter), and no value key.
  2. The key check. "value" in getter is false, which is a quick way to tell a getter from a plain property.
  3. Frozen flags. Object.freeze() sets writable and configurable to false. The property is still enumerable.

Example 3 — Inherited Properties, Copies and Errors

Only own properties are described, the descriptor is a copy, and primitives throw. The catch block prints the error type only.

JavaScript
const parent = { shared: 1 };
const child = Object.create(parent);
console.log("Inherited: " + Reflect.getOwnPropertyDescriptor(child, "shared"));

const obj = { count: 5 };
const desc = Reflect.getOwnPropertyDescriptor(obj, "count");
desc.value = 100;
console.log("Property after editing the copy: " + obj.count);

try {
  Reflect.getOwnPropertyDescriptor("abc", "length");
} catch (err) {
  console.log("Reflect with a string: " + err.name);
}
console.log("Object with a string: " + Object.getOwnPropertyDescriptor("abc", "length").value);
Try It Yourself

How It Works

  1. Own only. shared lives on parent, so the child has no own descriptor for it and you get undefined.
  2. A copy. Changing desc.value does not touch the object, so obj.count is still 5.
  3. Stricter than Object. Object.getOwnPropertyDescriptor() wraps the string and answers 3, while Reflect throws a TypeError for any primitive.

Browser & Runtime Support

Reflect.getOwnPropertyDescriptor() is part of ES2015 (ES6), together with the Reflect object. Every current browser and Node.js has it.

✓ ES2015 · Widely supported

Reflect.getOwnPropertyDescriptor()

Supported in Chrome 49+, Edge 12+, Firefox 42+, Safari 10+, Opera 36+ and Node.js 6+. Internet Explorer never got it.

ES2015 Standard since
Google Chrome 49+ · Desktop & Mobile
Full support
Microsoft Edge 12+ · Chromium and legacy
Full support
Mozilla Firefox 42+ · Desktop & Mobile
Full support
Apple Safari 10+ · macOS & iOS
Full support
Opera 36+ · Chromium based
Full support
Samsung Internet Recent versions · Android
Supported
Android WebView 49+ · Chromium based
Supported
Node.js 6+ · Server runtime
Supported
Deno Supported · JavaScript runtime
Supported
Bun Supported · JavaScript runtime
Supported
Internet Explorer No native support
Not supported
Reflect.getOwnPropertyDescriptor() Excellent

Bottom line: Safe to use in every current browser and in Node.js. The only thing to plan for is Internet Explorer, which has no Reflect at all.

Frequently Asked Questions

It returns a descriptor object for an own property: value, writable, enumerable and configurable for a normal property, or get, set, enumerable and configurable for a getter or setter. If the property does not exist as an own property, it returns undefined.
writable: the value can be changed. enumerable: the property is listed by loops and Object.keys(). configurable: the property can be deleted and its flags can be changed.
No. Only own properties have a descriptor. For a property that comes from the prototype you get undefined. Walk up with Reflect.getPrototypeOf() if you need to look further.
No. The descriptor is a copy. To apply changes, pass the edited descriptor to Reflect.defineProperty().
The results are the same for objects. Object.getOwnPropertyDescriptor() turns primitives such as strings into objects first, while Reflect.getOwnPropertyDescriptor() throws a TypeError if the target is not an object.

Next: Reflect.getPrototypeOf()

Learn how to find the prototype of an object, and how to walk up the prototype chain.

Reflect.getPrototypeOf() tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

9 people found this page helpful