FrontendDeveloper.in

JavaScript question detail

How do you determine if an object is sealed or not

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
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
Back to all JavaScript questions
Get LinkedIn Premium at Rs 399