Home » JavaScript Reflect preventExtensions() Method

JavaScript Reflect preventExtensions() Method

by Online Tutorials Library

JavaScript Reflect.preventExtensions() Method

The static Reflect.preventExtensions() method is used prevent future extensions to the object. This method is same as Object.preventExtensions() method.

Syntax:

Parameters:

Obj: It is the object on which to prevent extensions.

Return value:

This method returns true if the target was successfully set to prevent extensions. Otherwise, this method returns false.

Exceptions:

A TypeError, if the target is not an Object.

Browser Support:

Chrome 49
Edge 12
Firefox 42
Opera 36

Example 1

Output:

true  false  

Example 2

Output:

true  true  

Example 3

Output:

false  false  
Next TopicJavaScript Reflect

You may also like