Getting Started with Modern JavaScript — Proxy

Photo by Ken Suarez on Unsplash

Syntax

let proxy = new Proxy(target, handler)

Traps

Get

Set

proxyUser.age = ‘old’;
// -> TypeError: Age is just a number.
Uncaught TypeError: ‘set’ on proxy: trap returned falsish for property ‘age’

Conclusion

Getting Started Series

Frontend Architect • JavaScript Enthusiast • Educative.io Author • ngVikings organizer.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store