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
// creating an object constructor
// and assigning values to it
const object = {
property: 'hi geeksforgeeks'
};
// checking whether the object
// is sealed or not
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
// creating an object constructor
// and assigning values to it
const object = {
property: 'hi geeksforgeeks'
};
// Using seal() method to seal the object
Object.seal(object);
// checking whether the
// object is frozen or not
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:
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4