Reflect
The Reflect global object is a namespace that groups functions for the basic operations JavaScript performs on objects, such as reading, writing, or deleting a property. It can’t be constructed and only holds static members. Each method does the same job as an operator or an Object method, but as a plain function call. The methods that change an object report success with a Boolean:
> const cart = { items: 3 };
undefined
> Reflect.has(cart, "items")
true
> Reflect.set(cart, "items", 4)
true
> Reflect.deleteProperty(cart, "items")
true
> cart
{}
Reflect has one static method for each trap a Proxy handler can define, with the same name and arguments. A trap can therefore add its own logic and then hand the operation to Reflect to get the default behavior.
Like Math, Reflect isn’t a constructor, so using it with new or calling it throws a TypeError. Reflect was added in ES2015 along with Proxy.
Key Static Methods and Properties
| Member | Kind | Description |
|---|---|---|
Reflect.get() |
Static method | Returns a property’s value, with an optional receiver used as this for getters |
Reflect.set() |
Static method | Assigns a property and returns true on success or false on failure |
Reflect.has() |
Static method | Returns whether an object has a property, own or inherited, like the in operator |
Reflect.deleteProperty() |
Static method | Deletes a property and returns whether it succeeded, like the delete operator |
Reflect.ownKeys() |
Static method | Returns an array of all own property keys, including non-enumerable and symbol keys |
Reflect.defineProperty() |
Static method | Defines or changes a property and returns true or false instead of throwing |
Reflect.getOwnPropertyDescriptor() |
Static method | Returns the descriptor of an own property, or undefined if there’s none |
Reflect.getPrototypeOf(), Reflect.setPrototypeOf() |
Static method | Read an object’s prototype, or change it and return whether the change succeeded |
Reflect.isExtensible(), Reflect.preventExtensions() |
Static method | Check whether new properties can be added, or stop them from being added |
Reflect.apply() |
Static method | Calls a function with a given this value and an array-like of arguments |
Reflect.construct() |
Static method | Calls a constructor like new does, with an optional different new.target |
Every method takes its target as the first argument and throws a TypeError when the target is the wrong kind of value: a non-object for most methods, a non-function for Reflect.apply(), and a non-constructor for Reflect.construct().
Examples
A debugging tool wraps a view model in a proxy to log every property the view reads. The get trap forwards each read with Reflect.get() and passes the proxy as the receiver, so the getter’s own reads of this.first and this.last go through the trap too:
> const person = {
… first: "Ada",
… last: "Lovelace",
… get fullName() {
… return `${this.first} ${this.last}`;
… },
… };
undefined
> const tracked = new Proxy(person, {
… get(target, key, receiver) {
… console.log(`read ${String(key)}`);
… return Reflect.get(target, key, receiver);
… },
… });
undefined
> tracked.fullName
read fullName
read first
read last
'Ada Lovelace'
Forwarding with target[key] instead would run the getter with person as this, and the log would miss the reads of first and last.
Switch between the two forwarding lines and step through tracked.fullName to see which object the getter gets as this and which reads reach the trap:
A plugin system lets plugins add settings, but the core settings object may be frozen. Reflect.defineProperty() returns false when it can’t define the property, so the caller branches on the result instead of catching an exception:
> const settings = Object.freeze({ theme: "dark" });
undefined
> Reflect.defineProperty(settings, "lang", { value: "en" })
false
> Reflect.set(settings, "theme", "light")
false
An inspector that dumps an object’s full shape needs every key. Object.keys() returns only enumerable string keys, and Reflect.ownKeys() also lists non-enumerable and symbol keys:
> const id = Symbol("id");
undefined
> const user = { name: "Ada", [id]: 7 };
undefined
> Object.defineProperty(user, "token", { value: "x9f", enumerable: false });
{ name: 'Ada', Symbol(id): 7 }
> Object.keys(user)
[ 'name' ]
> Reflect.ownKeys(user)
[ 'name', 'token', Symbol(id) ]
Common Gotchas
A false result from Reflect.set() doesn’t throw, even in strict-mode code. The failed write is silent unless the caller checks the return value. Inside a Proxy trap, returning that false is what makes a strict-mode assignment throw.
Reflect methods don’t convert primitives to objects. Object.getPrototypeOf("hi") returns String.prototype, but the Reflect version throws:
> Reflect.getPrototypeOf("hi")
Uncaught TypeError: Reflect.getPrototypeOf called on non-object
at Reflect.getPrototypeOf (<anonymous>)
Have a question about this? Mentor AI can show you examples, compare related terms, and point you to tutorials.
By Leodanis Pozo Ramos • Updated Nov. 13, 2026