union(secondSet) { const unionSet = new Set() const firstSetValues = this.values() const secondSetValues = secondSet.values() const allSetValues = [...firstSetValues, ...secondSetValues] allSetValues.forEach(value => unionSet.add(value)) return unionSet }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter