Suppose we have a set like below
Way 1: By using Array.from()
We can use the new method ‘from’ which will be available on Arrays from ES6. The ‘from’ method returns an array from the passed iterable (in our case, we pass a Set)
Way 2: By using Spread Operator(…)
Way 3: By using forEach method
Way 4: By using the For..of method
Since for..of do not need any index, we can use this also to iterate through a Set.
We cannot use for..in loop or the ‘concat’ method on Sets which are available on arrays.