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:

Chrome6
EdgeYes
Firefox4
Opera12

Example 1

Output:

false

Example 2

Output:

false

Example 3

Output:

false





Latest Courses