JS Coding Questions Logo
JS Coding Questions
#199💼 Interview💻 Code

How do you determine if an object is sealed or not

Advertisement

728x90

The Object.isSealed() method is used to determine if an object is sealed or not. An object is sealed if all of the below conditions hold true

1. If it is not extensible.

2. If all of its properties are non-configurable.

3. If it is not removable (but not necessarily non-writable).

Let's see it in the action

javascript
1const object = {
2  property: "Hello, Good morning",
3  };
4
5Object.seal(object); // Using seal() method to seal the object
6
7console.log(Object.isSealed(object)); // checking whether the object is sealed or not

Advertisement

Responsive Ad
🎯 Practice NowRelated Challenge

JavaScript Coding Exercise 29

Test your knowledge with this interactive coding challenge.

Start Coding

Advertisement

728x90
199of476