Get to know MDN better
The Proxy and Reflect objects allow you to intercept and define custom behavior for fundamental language operations (e.g., property lookup, assignment, enumeration, function invocation, etc.). With the help of these two objects you are able to program at the meta level of JavaScript.
Proxy objects allow you to intercept certain operations and to implement custom behaviors.
For example, getting a property on an object:
The Proxy object defines a target (an empty object here) and a handler object, in which a get trap is implemented. Here, an object that is proxied will not return undefined when getting undefined properties, but will instead return the number 42.
Additional examples are available on the Proxy reference page.
The following terms are used when talking about the functionality of proxies.
handlerPlaceholder object which contains traps.
trapsThe methods that provide property access. (This is analogous to the concept of traps in operating systems.)
targetObject which the proxy virtualizes. It is often used as storage backend for the proxy. Invariants (semantics that remain unchanged) regarding object non-extensibility or non-configurable properties are verified against the target.
invariantsSemantics that remain unchanged when implementing custom operations are called invariants. If you violate the invariants of a handler, a TypeError will be thrown.
The following table summarizes the available traps available to Proxy objects. See the reference pages for detailed explanations and examples.
The Proxy.revocable() method is used to create a revocable Proxy object. This means that the proxy can be revoked via the function revoke and switches the proxy off.
Afterwards, any operation on the proxy leads to a TypeError.
Reflect is a built-in object that provides methods for interceptable JavaScript operations. The methods are the same as those of the proxy handler's.
Reflect is not a function object.
Reflect helps with forwarding default operations from the handler to the target.
With Reflect.has() for example, you get the in operator as a function:
Before Reflect, you typically use the Function.prototype.apply() method to call a function with a given this value and arguments provided as an array (or an array-like object).
With Reflect.apply this becomes less verbose and easier to understand:
With Object.defineProperty, which returns an object if successful, or throws a TypeError otherwise, you would use a try...catch block to catch any error that occurred while defining a property. Because Reflect.defineProperty() returns a Boolean success status, you can just use an if...else block here:
This page was last modified on Jul 8, 2025 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.