What is Object.isSealed() in JavaScript?
The Object.isSealed() method determines if an object is sealed or not. An object is sealed if:
- The object is not extensible.
- Its properties are non-configurable.
Note:
- An object is sealed using the
Object.seal()orObject.freeze()methods.- A sealed object cannot be unsealed.
Declaration
The isSealed() method is declared as follows:
Object.isSealed(obj)
obj: The object that is to be checked to determine whether it is sealed.
Note: If
objis not an object,TypeErroris thrown.
Return value
The isSealed() method returns a boolean value depending on whether or not the object obj is sealed.
true: ifobjis sealed.false: ifobjis not sealed.
Code
Consider the code snippet below, which demonstrates the use of the isSealed() function.
var obj = { property1:'Foo'}console.log("obj is sealed: ", Object.isSealed(obj))Object.seal(obj)console.log("obj is sealed: ", Object.isSealed(obj))
Explanation
An object obj is created in line 1. Calling the isSealed() method on obj returns false, as the object is not sealed. After obj is sealed in line 5, the isSealed() method returns true.
Free Resources
Copyright ©2026 Educative, Inc. All rights reserved