Proxy
A JavaScript Proxy is an object that intercepts operations on a target object through trap functions defined by a handler.
Secrets of the JavaScript Ninja, Second Edition
A JavaScript object that intercepts operations on a target object using a handler.
- How it is used
- Uses proxies to control object access and add cross-cutting concerns such as logging and performance measurement.
- How deep it goes
- Explains get, set, and apply traps through worked examples, without surveying other traps.
- Examples
- Uses a Ninja object for property logging and an isPrime function for call timing.
- What you can do after
- Apply Proxy traps to log property access and measure function-call duration without modifying target code.
Read how Secrets of the JavaScript Ninja, Second Edition explains Proxy →
Secrets of the JavaScript Ninja, Third Edition
Proxy is a JavaScript built-in object type that mediates operations on a target object through configurable interception functions.
- How it is used
- Mediates object interactions to add custom behavior such as logging, validation, or computed properties.
- How deep it goes
- Explains target and handler mechanics, several traps, and Reflect forwarding, without detailing the full trap list.
- Examples
- Uses an emperor object to demonstrate reading, updating, and restricting properties through a proxy.
- What you can do after
- Build a proxy that customizes property reads and assignments while forwarding permitted operations to its target.
Read how Secrets of the JavaScript Ninja, Third Edition explains Proxy →
Also covered in
- Vanilla WebIn early access (MEAP)
Related concepts
- trapuses · A JavaScript Proxy trap is a handler function that intercepts a specific operation performed through the proxy.
- getteralternative to · A property accessor that executes code and returns a value when the property is read.
- loguses · A log is a time-ordered record of events, messages, or activity generated by a system or process.
- arraycontrasts with · An array is an ordered collection of elements organized in one or more dimensions and accessible by position or index.
- negative indexingimplements · Negative indexing is a convention for identifying sequence positions or structural lines by counting backward from the end.
Questions about Proxy
What is Proxy?
A JavaScript Proxy is an object that intercepts operations on a target object through trap functions defined by a handler.
Which Manning books explain Proxy?
Secrets of the JavaScript Ninja, Second Edition and Secrets of the JavaScript Ninja, Third Edition.
What is the difference between Proxy and getter?
A JavaScript Proxy is an object that intercepts operations on a target object through trap functions defined by a handler. A property accessor that executes code and returns a value when the property is read.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

