Preventing modification of Objects
There are many ways to lock an object according to your needs.
Freezing an object can be useful for representing a logically immutable data structure , especially if changing the properties of the object could lead to bad behaviour elsewhere in your application. Object.freeze(…) is shallow, this means that object values in a frozen object are still mutable.
Object.seal is a superset of Object.preventExtensions in functionality in that while it prevents tacking on of arbitrary properties to objects it also prevents altering the attributes of the properties that already exist on the object. Also, it disallows deleting properties .
Object.preventExtensions() sets the extensible attribute of o to false so that no new properties can be added to it. This is a permanent change: once an object has been made non-extensible, it cannot be make extensible again.