Home » JavaScript handler has() Method

JavaScript handler has() Method

by Online Tutorials Library

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

Chrome 49
Edge 12
Firefox 18
Opera 36

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  

Next TopicJavaScript handler

You may also like