isSealed
The isSealed function checks if an object is sealed, meaning new properties cannot be added and existing ones cannot be removed.
Syntax
typescript
isSealed(obj): booleanParameters
| Name | Type | Description |
|---|---|---|
obj | object | Object to be checked. |
Return
| Type | Description |
|---|---|
boolean | Returns true if the object is sealed, otherwise false. |
Examples
typescript
const obj = Object.seal({ a: 1 });
isSealed(obj); // true
isSealed({ b: 2 }); // falseNotes
- Internally uses
Object.isSealed. - Sealed objects cannot have properties added or removed, but existing property values can still be changed.
