The JavaScript Set was introduced in ES2015 but lacked functions for working with multiple sets. Now, with new methods like union, intersection, and difference, Sets can be more robust and efficient. These methods simulate SQL joins and provide solutions to common set operations. The proposal for these new Set methods is currently at stage 3 in TC39’s process, with implementations already available in Safari 17 and Chrome 122. Edge and Firefox are expected to follow suit. Polyfills are also available for older JavaScript engines. These additions make Sets feel more complete, reducing the need for external dependencies and custom implementations. The future of JavaScript looks promising with more enhancements on the horizon.
https://www.sonarsource.com/blog/union-intersection-difference-javascript-sets/