Skip to main content
InterviewHubPRO
Section Overview
Q203

Question 203 of 536

Part 4: Prototypes, Object Methods & Event Loop (174 - 253)

38%
JavaScript & V8 Internals (536 Qs)•Part 4: Prototypes, Object Methods & Event Loop (174 - 253)

How do you determine if an object is sealed or not

mid LevelMost AskedCode ExampleEvent LoopPrototypes

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
  const object = {
    property: "Hello, Good morning",
  };

  Object.seal(object); // Using seal() method to seal the object

  console.log(Object.isSealed(object)); // checking whether the object is sealed or not