JavaScript Set union()
Example
const A = new Set(['a','b','c']);
const B = new Set(['b','c','d']);
const C = A.union(B);
Try it Yourself »
Description
The union() method returns the union of two sets.
The union() method returns a new set containing the
elements which are in this set, or in the argument set, or in both.

Syntax
union(set)
Parameters
| Parameter | Description |
| set | Required. The set to union. |
Return Value
| Type | Description |
| Set | A set object with the union of the two sets. |
Set Logic Metods:
See Also:
Browser Support
Set.union() is supported in all modern browsers since June 2024:
| Chrome 122 | Edge 122 | Firefox 127 | Safari 17 | Opera 108 |
| Feb 2024 | Feb 2024 | Jun 2024 | Sep 2023 | Mar 2024 |