Home » JavaScript Object freeze() Method

JavaScript Object freeze() Method

by Online Tutorials Library

JavaScript Object.freeze() Method

The Object.freeze() method freezes an object that prevents new properties from being added to it. This method prevents the modification of existing property, attributes, and values.

Syntax:

Parameter

Obj: The object to freeze.

Return value:

This method returns the object that was passed to the function.

Browser Support:

Chrome 45.0
Edge 12.0
Firefox 32.0
Opera No

Example 1

Output:

22  

Example 2

Output:

" freeze "  

Example 3

Output:

[object Object] {   name: "charry",    prop: function() {}  }  [object Object] {   name: "karri"  }  [object Object] {   name: "karri"  }  

Next TopicJavaScript Objects

You may also like