Set values() JavaScript

The JavaScript Set values() method gives an object of Set iterator that contains the values for each element. It is similar to the keys() method of Map.

Syntax:

setObj.values()

Return:
Iterator object.

Example:

<!DOCTYPE html>
<html>
<body>
<script>  
var jewels = new Set();  
jewels.add("DIAMOND").add("GOLD").add("PLATINUM").add("SILVER");
var gems =jewels.values();  
document.writeln(gems.next().value+"<br>");  
document.writeln(gems.next().value+"<br>");  
document.writeln(gems.next().value+"<br>");  
document.writeln(gems.next().value);    
</script>
</body>
</html>

Output:

DIAMOND
GOLD
PLATINUM
SILVER
Please Share