JavaScript handler.preventExtensions() Method

18 Mar 2025 | 1 min read

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

Output:

 true 

Example 2

Output:

 true [object Object] false 

Example 3

Output:

 false false