1×
Become a member
to unlock all features

Level Up!

Access all courses & lessons on egghead today and lock-in your price for life.

Autoplay

    Protect a JavaScript Object from Changes with Object.freeze()

    javascriptJavaScript

    In this lesson we'll learn how to prevent changes to an object in JavaScript using the built in Object.freeze() method. Once an object has been passed to Object.freeze(), no properties can be added, removed, or changed.

    This is helpful in a variety of situations, particularly with preventing inadvertent changes to an object's data throughout a codebase.