JavaScript handler.has() Method

The handler.has() method used to "hide" any property you want. It's a trap for an operator. It returns the Boolean value true if you want the property to be accessed, otherwise false If the key is present or not in the original object.

Syntax

Parameters

target: The target object.

prop: The property to check for existence.

Return value

Return a Boolean value.

Browser Support

Chrome49
Edge12
Firefox18
Opera36

Example 1

Test it Now

Output:

in has true

Example 2

Test it Now

Output:

a in d: false
b in d: true

Example 3

Test it Now

Output:

called: a false





Latest Courses