Home » Javascript Object preventExtensions() Method

Javascript Object preventExtensions() Method

by Online Tutorials Library

JavaScript Object.preventExtensions() Method

The Object.preventExtensions() only prevents the addition of new properties from ever being added to an object (i.e., prevents future extensions to the object). This change is a permanent that means once an object has been made non-extensible, it cannot make extensible again.

Syntax:

Parameter:

obj: It is the object which should be made non-extensible.

Return value:

It returns the object being made non-extensible.

Browser Support:

Chrome 6
Edge Yes
Firefox 4
Opera 12

Example 1

Output:

false  

Example 2

Output:

false  

Example 3

Output:

false  

Next TopicJavaScript Objects

You may also like