117
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
Output:
in has true
Example 2
Output:
a in d: false b in d: true
Example 3
Output:
called: a false
Next TopicJavaScript handler