1×
Become a member
to unlock all features

Create egghead account to access 5000+ tutorials and resources from expert developers.

Create account
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.