Example of set in Javascript ES6
Here is an example of iterating through the values of a set in ES6…
Unlike Map, it can only contain unique values. You add to a set using “add” instead of “set”. Note that when we try to add an duplicate value, it will not add to set as evidence by the size property we only still have four items.
Like the map, the set has methods like delete(), clear(), and has()…