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.