JavaScript Object.seal() Method
The Object.seal() static method stops properties being added to or removed from an object, while still letting existing values change.
Description
The Object.seal() static method seals an object: new properties can't be added and existing ones can't be deleted or reconfigured, but the values of writable properties can still be changed. It sits between a normal object and a frozen one. Like freezing, it's shallow.
Sealing is useful for objects whose shape should stay fixed, such as a configuration object with known settings, while still letting values change. Typos in property names then throw in strict mode instead of quietly creating a new property.
Object.isSealed() checks whether an object is sealed. Like freezing, sealing only affects the object itself, so objects stored inside it can still gain or lose properties unless you seal them too.
Syntax
Object.seal(obj)Parameters
- objThe object to seal.
Return Value
The same object, now sealed.
Example
Browser Support
The following information will show you the current browser support for the Object.seal() method. Hover over a browser icon to see the version that first introduced support for this method.
Desktop





Tablets & Mobile





