85
JavaScript Set has() method
The JavaScript Set has() method indicates whether the Set object contains the specified value. It returns true if the specified value is present, otherwise false.
Syntax
The has() method is represented by the following syntax:
Parameter
value – It represents the value to be searched.
Return
A Boolean value.
JavaScript Set has() method example
Here, we will understand has() method through various examples.
Example 1
Let’s see an example to determine whether the set object contains the specified value.
Output:
true
Example 2
Let’s see one more example to determine whether the set object contains the specified value.
Output:
false false
Next TopicJavaScript Set values() Method