Proxy() constructor - JavaScript | MDN Skip to main content Skip to search MDN HTML HTML: Markup language HTML reference Elements Global attributes Attributes See all… HTML guides Responsive images HTML cheatsheet Date & time formats See all… Markup languages SVG MathML XML CSS CSS: Styling language CSS reference Properties Selectors At-rules Values See all… CSS guides Box model Animations Flexbox Colors See all… Layout cookbook Column layouts Centering an element Card component See all… JavaScriptJS JavaScript: Scripting language JS reference Standard built-in objects Expressions & operators Statements & declarations Functions See all… JS guides Control flow & error handing Loops and iteration Working with objects Using classes See all… Web APIs Web APIs: Programming interfaces Web API reference File system API Fetch API Geolocation API HTML DOM API Push API Service worker API See all… Web API guides Using the Web animation API Using the Fetch API Working with the History API Using the Web speech API Using web workers All All web technology Technologies Accessibility HTTP URI Web extensions WebAssembly WebDriver See all… Topics Media Performance Privacy Security Progressive web apps Learn Learn web development Frontend developer course Getting started modules Core modules MDN Curriculum Check out the video course from Scrimba, our partner Learn HTML Structuring content with HTML module Learn CSS CSS styling basics module CSS layout module Learn JavaScript Dynamic scripting with JavaScript module Tools Discover our tools Playground HTTP Observatory Border-image generator Border-radius generator Box-shadow generator Color format converter Color mixer Shape generator About Get to know MDN better About MDN Advertise with us Community MDN on GitHub Blog Toggle sidebar Web JavaScript Reference Standard built-in objects Proxy Proxy() Theme OS default Light Dark English (US) Remember language Learn more Deutsch English (US) Español Français 日本語 한국어 中文 (简体) Proxy() constructor Baseline Widely available This feature is well established and works across many devices and browser versions. It’s been available across browsers since September 2016. Learn more See full compatibility The Proxy() constructor creates Proxy objects. In this article Syntax Description Examples Specifications Browser compatibility See also Syntax js new Proxy(target, handler) Note: Proxy() can only be constructed with new. Attempting to call it without new throws a TypeError. Parameters target A target object to wrap with Proxy. It can be any sort of object, including a native array, a function, or even another proxy. handler An object whose properties are functions that define the behavior of the proxy when an operation is performed on it. Description Use the Proxy() constructor to create a new Proxy object. This constructor takes two mandatory arguments: target is the object for which you want to create the proxy handler is the object that defines the custom behavior of the proxy. An empty handler will create a proxy that behaves, in almost all respects, exactly like the target. By defining any of a set group of functions on the handler object, you can customize specific aspects of the proxy's behavior. For example, by defining get() you can provide a customized version of the target's property accessor. Handler functions This section lists all the handler functions you can define. Handler functions are sometimes called traps, because they trap calls to the underlying target object. handler.apply() A trap for a function call. handler.construct() A trap for the new operator. handler.defineProperty() A trap for Object.defineProperty. handler.deleteProperty() A trap for the delete operator. handler.get() A trap for getting property values. handler.getOwnPropertyDescriptor() A trap for Object.getOwnPropertyDescriptor. handler.getPrototypeOf() A trap for Object.getPrototypeOf. handler.has() A trap for the in operator. handler.isExtensible() A trap for Object.isExtensible. handler.ownKeys() A trap for Object.getOwnPropertyNames and Object.getOwnPropertySymbols. handler.preventExtensions() A trap for Object.preventExtensions. handler.set() A trap for setting property values. handler.setPrototypeOf() A trap for Object.setPrototypeOf. Examples Selectively proxy property accessors In this example the target has two properties, notProxied and proxied. We define a handler that returns a different value for proxied, and lets any other accesses through to the target. js const target = { notProxied: "original value", proxied: "original value", }; const handler = { get(target, prop, receiver) { if (prop === "proxied") { return "replaced value"; } return Reflect.get(...arguments); }, }; const proxy = new Proxy(target, handler); console.log(proxy.notProxied); // "original value" console.log(proxy.proxied); // "replaced value" Specifications Specification ECMAScript® 2027 Language Specification # sec-proxy-constructor Browser compatibility Enable JavaScript to view this browser compatibility table. See also Meta programming guide Reflect Help improve MDN Was this page helpful to you? Yes No Learn how to contribute This page was last modified on May 22, 2026 by MDN contributors. View this page on GitHub • Report a problem with this content Filter sidebar Clear filter input Standard built-in objects Proxy/handler Instance methods apply() construct() defineProperty() deleteProperty() get() getOwnPropertyDescriptor() getPrototypeOf() has() isExtensible() ownKeys() preventExtensions() set() setPrototypeOf() Inheritance Object/Function Static methods apply() bind() call() toString() [Symbol.hasInstance]() Static properties displayName length name prototype arguments caller Instance methods __defineGetter__() __defineSetter__() __lookupGetter__() __lookupSetter__() hasOwnProperty() isPrototypeOf() propertyIsEnumerable() toLocaleString() toString() valueOf() Instance properties __proto__ constructor Related pages Proxy MDN Your blueprint for a better internet. MDN About Blog Mozilla careers Advertise with us MDN Plus Product help Contribute MDN Community Community resources Writing guidelines MDN Discord MDN on GitHub Developers Web technologies Learn web development Guides Tutorials Glossary Hacks blog Mozilla Website Privacy Notice Telemetry Settings Legal Community Participation Guidelines Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.