Returns true if existing property attributes and values cannot be modified in an object, and new properties cannot be added to the object.
SyntaxObject.isFrozen( object )
true if all of the following are true:
If the object has no existing properties, the function returns true if the object is non-extensible.
ExamplesThe following example illustrates the use of the Object.isFrozen function.
var obj = { pasta: "spaghetti", length: 10 };
Object.freeze(obj);
document.write(obj.isFrozen());
obj.newProp = 50;
document.write (obj.newProp);
document.write ("<br/>");
delete obj.length;
document.write (obj.length);
document.write ("<br/> ");
obj.pasta = "linguini";
document.write (obj.pasta);
Remarks
When the configurable attribute of a property is false , the property attributes cannot be changed and the property cannot be deleted. When writable is false , the data property value cannot be changed. When configurable is false and writable is true , the value and writable attributes can be changed.
For information about how to set property attributes, see Object.defineProperty Function. To obtain the attributes of a property, you can use the Object.getOwnPropertyDescriptor Function.
The following related functions prevent the modification of object attributes.
The following functions return true if all of the conditions marked in the following table are true.
Function Object is extensible? configurable is false for all properties? writable is false for all data properties? Object.isExtensible Yes No No Object.isSealed No Yes No Object.isFrozen No Yes Yes ExceptionsIf the object argument is not an object, a TypeError exception is thrown.
See also Other articlesMicrosoft Developer Network: Article
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4