JavaScript handler.preventExtensions() Method

The handler.preventExtensions() method is used to trap the Object.preventExtensions method. When extensions are prevented on an object, new properties can't be added.

Syntax

Parameters

target: The target object.

Return value

Return a Boolean value.

Browser Support

Chrome49
Edge12
Firefox22
Opera36

Example 1

Test it Now

Output:

true

Example 2

Test it Now

Output:

true 
[object Object] 
false

Example 3

Test it Now

Output:

false
 false





Latest Courses