JavaScript Set symmetricDifference()
Example
const A = new Set(['a','b','c']);
const B = new Set(['b','c','d']);
const C = A.symetricDifference(B);
Try it Yourself »
Description
The symmetricDifference()
method returns the symmetric difference between two sets.
The symmetricDifference()
method returns a new set containing elements which are in this set
or in the argument set, but not in both:
Syntax
symmetricDifference(set)
Parameters
Parameter | Description |
set | Required. The set to test for symmetric difference. |
Return Value
Type | Description |
Set | A set object with the symmetric difference. |
Set Logic Metods:
See Also:
Browser Support
The symmetricDifference()
method 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 |