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() or Object.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 obj is not an object, TypeError is thrown.

Return value

The isSealed() method returns a boolean value depending on whether or not the object obj is sealed.

  • true: if obj is sealed.
  • false: if obj is 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.

New on Educative
Learn to Code
Learn any Language as a beginner
Develop a human edge in an AI powered world and learn to code with AI from our beginner friendly catalog
🏆 Leaderboard
Daily Coding Challenge
Solve a new coding challenge every day and climb the leaderboard

Free Resources

Copyright ©2025 Educative, Inc. All rights reserved