JavaScript Reflect

Beginner
8 min read
Updated: Nov 2026
3 examples
Object operations

Definition and Usage

Reflect is a built-in JavaScript object with thirteen static methods for working with objects: reading and writing properties, defining and deleting them, listing keys, checking and changing the prototype, calling functions and creating objects. Each method does something you can already do with an operator or an Object method, but as a plain function with a predictable result.

Many Reflect methods return true or false instead of throwing an error, so you can check whether an action worked. Reflect is also the partner of Proxy: every Proxy trap has a Reflect method with the same name and the same arguments, which makes forwarding the normal behaviour easy.

This page explains the idea. The Reflect Methods index links the full guides for every method, from apply() to setPrototypeOf().

Reflect is not a constructor.

You never write new Reflect() and you cannot call Reflect() either. It is a plain object, like Math, and you only use its methods, such as Reflect.get(). It works in every modern browser and in Node.js.

JavaScript Syntax

Call a Reflect method with the object as the first argument:

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

console.log(Reflect.get(user, "name"));          // Ann
console.log(Reflect.set(user, "age", 30));       // true
console.log(Reflect.has(user, "age"));           // true
console.log(Reflect.ownKeys(user).join(", "));   // name, age
console.log(Reflect.deleteProperty(user, "age")); // true

Core Ideas

Ideas every Reflect tutorial in this series builds on:

IdeaExampleRemember
ReflectReflect.get(obj, "a")A built-in object that holds the methods. You do not create it
TargetReflect.has(target, key)The object you work on. It is always the first argument and must be an object
Property key"name" or Symbol("id")The name of a property: a string or a symbol
Boolean resultReflect.set(obj, "a", 1)Many methods return true or false instead of throwing
ReceiverReflect.get(obj, "a", other)The object used as this inside getters and setters
PrototypeReflect.getPrototypeOf(obj)The object that another object inherits from
Proxynew Proxy(target, handler)An object that intercepts operations, and often forwards them with Reflect

Reflect vs Object and Operators

The same job can often be done in two ways. Reflect gives a function with a clear result:

TaskOlder wayReflect way
Check a property"a" in objReflect.has(obj, "a")
Delete a propertydelete obj.aReflect.deleteProperty(obj, "a") (returns true or false)
Define a propertyObject.defineProperty() (throws on failure)Reflect.defineProperty() (returns true or false)
Call a functionfn.apply(thisArg, args)Reflect.apply(fn, thisArg, args)
Create an objectnew Fn(...args)Reflect.construct(Fn, args)
Get all own keysObject.getOwnPropertyNames() plus symbolsReflect.ownKeys(obj)

Use the normal syntax in everyday code. Reach for Reflect when you want a boolean result instead of an error, when you work with a Proxy, or when you need to pass the action around as a function. Another difference: most Object methods quietly accept a primitive, while Reflect methods throw a TypeError for anything that is not an object.

How Reflect Works

Static methods only

Reflect has no instances and no state. Every method is called on Reflect itself, for example Reflect.get(obj, "a").

The target comes first

The first argument is always the object to work on. If it is not an object (a number, a string, null), the call throws a TypeError.

Failure is a value

Methods such as set(), defineProperty(), deleteProperty() and preventExtensions() return false when the action is not allowed. You decide what to do next, and no try...catch is needed.

Same names as Proxy traps

A Proxy handler can define traps such as get, set and has. Reflect has a method with each of those names, so a trap can call Reflect.get(...arguments) to do the normal thing.

Symbols are keys too

Property keys can be strings or symbols. Methods like ownKeys() include symbol keys and hidden properties, which many older tools skip.

Real-Life Uses

Reflect is a small toolbox with a few clear jobs. Common uses:

UseHow Reflect helps
Proxy handlersForward the normal action after logging, checking or changing something: return Reflect.set(target, key, value, receiver).
Safe property changesTry to define or delete a property and use the true or false result, with no try...catch.
Calling with an arrayCall any function with an array of arguments and a chosen this, even when the function has its own apply property.
Inspecting objectsList every own key, including symbols and hidden ones, and check or change the prototype and extensibility.

JavaScript Examples

Three short programs. Each one prints plain text that is the same every time you run it, and they all run in Node.js.

Example 1 — A Quick Tour of Reflect

Read, set, check and delete a property, list the keys and call a function, all with Reflect methods.

JavaScript
const user = { name: "Ann", age: 30 };

console.log("Read: " + Reflect.get(user, "name"));
Reflect.set(user, "age", 31);
console.log("Age now: " + user.age);
console.log("Has email: " + Reflect.has(user, "email"));

Reflect.deleteProperty(user, "age");
console.log("Keys: " + Reflect.ownKeys(user).join(", "));
console.log("Max: " + Reflect.apply(Math.max, undefined, [3, 9, 4]));
get() tutorial

How It Works

  1. Read and write. Reflect.get() reads name, and Reflect.set() changes age to 31. They work like user.name and user.age = 31.
  2. Check and delete. Reflect.has() says there is no email. Reflect.deleteProperty() removes age, so only name is left.
  3. Call a function. Reflect.apply() calls Math.max with the numbers in the array and gives 9.

Example 2 — Results Instead of Errors

Try to change a frozen object. Each Reflect method answers false, while Object.defineProperty() throws. The catch block prints the error type only.

JavaScript
const locked = Object.freeze({ id: 1 });

console.log("Reflect.set: " + Reflect.set(locked, "id", 2));
console.log("Reflect.defineProperty: " + Reflect.defineProperty(locked, "extra", { value: 1 }));
console.log("Reflect.deleteProperty: " + Reflect.deleteProperty(locked, "id"));

try {
  Object.defineProperty(locked, "extra", { value: 1 });
} catch (err) {
  console.log("Object.defineProperty: " + err.name);
}
console.log("id is still " + locked.id);

How It Works

  1. A frozen object. Object.freeze() stops all changes: no new properties, no new values and no deleting.
  2. Reflect answers false. Each of the three Reflect calls fails quietly and tells you so with false. Your code keeps running.
  3. Object throws. Object.defineProperty() reports the same failure as a TypeError. The value of id never changed.

Example 3 — Reflect with a Proxy

A Proxy watches reads and writes. Inside each trap, Reflect does the normal action, so the object still works as expected.

JavaScript
const logs = [];

const user = new Proxy({ name: "Ann" }, {
  get(target, key, receiver) {
    logs.push("get " + String(key));
    return Reflect.get(target, key, receiver);
  },
  set(target, key, value, receiver) {
    logs.push("set " + String(key));
    return Reflect.set(target, key, value, receiver);
  }
});

console.log("Name: " + user.name);
user.name = "Bob";
console.log("Name now: " + user.name);
console.log("Log: " + logs.join(", "));
set() tutorial

How It Works

  1. A watching object. The Proxy wraps { name: "Ann" }. Its get and set traps run for every read and write, and they save a short note in logs.
  2. Reflect does the real work. Reflect.get() and Reflect.set() use the same arguments as the traps, so the value is read and stored in the normal way.
  3. Same result, plus a log. The name is read, changed to Bob and read again, and the log shows the three steps in order.

Reflect Methods

Reflect has 13 methods. Each one has its own tutorial:

MethodWhat it does
apply()Call a function with a chosen this and an array of arguments.
construct()Create an object from a constructor, like new as a function.
defineProperty()Add or change a property and get true or false.
deleteProperty()Remove a property and get true or false.
get()Read the value of a property.
getOwnPropertyDescriptor()Read the flags and value of an own property.
getPrototypeOf()Find the prototype of an object.
has()Check whether a property is in an object, like in.
isExtensible()Check whether new properties can be added.
ownKeys()List every own key, including symbols and hidden ones.
preventExtensions()Stop new properties from being added.
set()Assign a value to a property and get true or false.
setPrototypeOf()Change the prototype of an object.

Full list: Reflect Methods index.

Frequently Asked Questions

Reflect is a built-in object with static methods for working with objects: get, set, has, delete, define, list keys, change the prototype, call functions and create objects. It is not a constructor, so you never use new with it.
To put the object operations in one place as normal functions with predictable results, and to give every Proxy trap a matching method. It arrived with ES2015, the same version that added Proxy.
Many methods overlap. The main differences are that several Reflect methods return true or false instead of throwing, that Reflect methods throw a TypeError for non-objects instead of converting them, and that Reflect has no constructor or instance methods.
No. Normal syntax such as obj.a, obj.a = 1 and delete obj.a is simpler. Reflect is useful with Proxy, when you want a boolean result instead of an error, or when you need an action as a function.
A Proxy handler has traps such as get, set and has. Reflect has a method with the same name and arguments for each trap, so inside a trap you can call Reflect to do the default behaviour.

Ready for the method guides?

Open the Reflect Methods index to learn every method with syntax, runnable examples and FAQs.

Reflect Methods index →

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.

15 people found this page helpful