In this topic : Simplest way to merge ES6 Maps/Sets?
I found a nice way to merge Set or Map
let set3 = new Set(function*() { yield* set1; yield* set2; }());
I would like to make a function that can merge any number of Sets like so :
function mergeSets() {
return new Set(function*() {
for (const set of arguments) {
yield* set
}
}())
}
I there a way to ? When i test this one i get an empty Set as result