The isSealed() Method in JavaScript
Learn all about the isSealed() method of the Object object in JavaScript.
The isSealed() method accepts an object as an argument and returns true if the object is sealed, and false otherwise. An object is considered sealed when it is a return value of the Object.seal() function.
Here’s an example illustrating the usage of isSealed():
1 | const dog = {} |
In this example, both the dog
and myDog
objects are sealed. When the argument is passed to the Object.seal() function, it mutates the object and prevents it from being unsealed. Additionally, the function returns the same object as the argument, making dog === myDog (they refer to the same exact object).
tags: [“JavaScript”, “Object object”, “isSealed() method”]