JavaScript Object.isSealed()
Example
const person = {firstName:"John", lastName:"Doe"};
// Seal Object
Object.seal(person);
// This will return true
let answer = Object.isSealed(person);
More Examples Below !
Description
The Object.isSealed()
returns true if an object is sealed.
Related Methods:
Object.preventExtensions() allows modifications, but prevents addition of properties.
Object.seal() allows modifications, but prevents additions and deletions of properties.
Object.freeze() prevents modifications, additions and deletions of properties.
Object.isExtensible() returns true if an object is extensible.
Object.isSealed() returns true if an object is sealed.
Object.isFrozen() returns true if an object is frozen.
Syntax
Parameters
The object to check.
Return Value
true
if the object is sealed.false
if not.
More Examples
Example
const fruits = ["Banana", "Orange", "Apple", "Mango"];
// Seal Array
Object.seal(fruits);
// This will return true
let answer = Object.isSealed(fruits);
Browser Support
Object.isSealed()
is an ECMAScript5 (ES5 2009) feature.
JavaScript 2009 is supported in all browsers since July 2013:
Chrome 23 |
IE/Edge 11 |
Firefox 21 |
Safari 6 |
Opera 15 |
Sep 2012 | Sep 2012 | Apr 2013 | Jul 2012 | Jul 2013 |