Set.prototype.has

Returns a boolean indicating whether an element with the specified value exists in a Set object.

Syntax

has(item)

Parameters

Return value

true if an element with the specified value exists in the Set object; otherwise false.

Examples

let s = new Set([1, 2, 3])
s.has(2)
true