Javatpoint Logo
Javatpoint Logo

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:

Chrome 49
Edge 12
Firefox 42
Opera 36

Example 1

Output:

 true

Example 2

Output:

 false

Example 3

Output:

true
true
false

false
Next TopicJavaScript Reflect





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA