DEV Community

Cover image for Learn the JavaScript Proxy Object: Creating Immutable Objects

Learn the JavaScript Proxy Object: Creating Immutable Objects

Nick Scialli (he/him) on June 02, 2020

While JavaScript allows us to mutate objects, we might choose to not allow ourselves (and fellow programmers) to do so. One of the best examples of...
Collapse
 
gabbersepp profile image
Josef Biehler

Nice. Did not know Proxy object. Is this approach equal to Object.freeze()?

Collapse
 
nas5w profile image
Nick Scialli (he/him)

Object.freeze is shallow, so it’ll only make first level props immutable. Anything deeper would need to be recursively frozen.