Set has() JavaScript

The JavaScript Set has() method indicates whether the Set object contains the specified value element.

Syntax:

setObj.has(value)

Parameters:
value: It represents the value of the element whose presence has to be checked in the Set object.

Return:
It returns true if the specified element is in the set otherwise returns false.

Example:

<!DOCTYPE html>
<html>
<body>
<script>
var jewels = new Set();
jewels.add("DIAMOND").add("GOLD").add("PLATINUM").add("SILVER");
document.writeln(jewels.has("GOLD"));
</script>
</body>
</html>