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:

Chrome45.0
Edge12.0
Firefox32.0
OperaNo

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"
}





Latest Courses