JavaScript Object.isFrozen()
Example
// Create Object
const person = {firstName:"John", lastName:"Doe"};
// Freeze Object
Object.freeze(person);
// This will return true
let text = Object.isFrozen(person);
Try it Yourself »
More Examples Below !
Description
The Object.isFrozen()
returns true if an object is frozen.
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
Object.isFrozen(object)
Parameters
Parameter | Description |
object | Required. The object to check. |
Return Value
Type | Description |
Boolean | true if the object is frozen.false if not. |
More Examples
Example
const fruits = ["Banana", "Orange", "Apple", "Mango"];
Object.freeze(fruits);
// This will return true:
let answer = Object.isFrozen(fruits);
Try it Yourself »
Browser Support
Object.isFrozen()
is an ECMAScript5 (ES5) feature.
ES5 (JavaScript 2009) is fully supported in all modern 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 |