JavaScript Reflect.has() Method

The static Reflect.has() method is used to check if a property exists in an object. It works like the in operator as a function.

Syntax:

Parameters:

target: It is the object in which to look for the property.

propertyKey: It is the name of the property to check.

Return value:

It returns a Boolean which indicates whether or not the target has the property.

Exceptions:

A TypeError, if the target is not an Object.

Browser Support:

Chrome49
Edge12
Firefox42
Opera36

Example 1

Output:

 true

Example 2

Output:

 false

Example 3

Output:

true
true
false

false




Latest Courses