JS: Set.prototype.has

By Xah Lee. Date: . Last updated: .

(new in JS: ECMAScript 2015)

mySet.has(value)

Return true if value is in set. Else, false.

const xx = new Set([3, 4, 5]);

// check existence

console.log(xx.has(5) === true);
console.log(xx.has(99) === false);

JS Set, Size Add Remove