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

    Limit Changes to a JavaScript object with Object.seal()

    javascriptJavaScript

    In this lesson we'll learn how to limit the types of changes that can be done to an object in JavaScript using the built in Object.seal() method. Once an object has been passed to Object.seal(), existing properties can be updated, but no new properties can be added and no properties can be deleted.

    This is helpful in a variety of situations, particularly with preventing inadvertent changes to an object's structure throughout a codebase, while still allowing for updates.