JavaScript Object isSealed() Method (original) (raw)

Last Updated : 19 Jun, 2023

JavaScript object.isSealed() method is used to determine if an object is sealed or not. An object is sealed if all of the below-mentioned conditions hold true :

Object.isSealed() takes the object as an argument that has to be checked and returns a boolean representing whether the object is sealed or not.

Syntax:

Object.isSealed(obj)

Parameters:

Return Value: Object.isSealed() returns a boolean representing whether the object is sealed or not.

Examples of the above function are provided below.

Example 1: In the above example the object has not been sealed using the Object.seal() method, therefore, it returns false when it is checked using Object.isSealed() method.

Javascript

const object = {

`` property: 'hi geeksforgeeks'

};

console.log(Object.isSealed(object));

Output:

false

Example 2: In the above example the object has been sealed using the Object.seal() method, therefore, it returns true when it is checked using Object.isSealed() method.

Javascript

const object = {

`` property: 'hi geeksforgeeks'

};

Object.seal(object);

console.log(Object.isSealed(object));

Output:

true

Applications:

Exceptions :

We have a complete list of Javascript Object methods, to check those please go through this JavaScript Object Complete Reference article.

Supported Browsers: