Name
Object.isSealed() — can properties be added to or deleted from an object?
Availability
ECMAScript 5
Synopsis
Object.isSealed(o)
Arguments
oThe object to be checked
Returns
true if
o is sealed, or false if it is not.
Description
An object is sealed if no new (non-inherited) properties can
be added to it and no existing (non-inherited) properties can be
deleted from it. Object.isSealed() tests whether its
argument is sealed or not. Once sealed, an object can never be
unsealed. The usual way to seal an object is by passing it to Object.seal() or Object.freeze(). It is also possible to seal an
object by passing it to Object.preventExtensions() and then using Object.defineProperty() to make all of its properties
non-deleteable.
Note that this is not a method to be invoked on an object: it is a global function and you must pass an object to it.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access