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

Syntax
difference(set)
Parameters
| Parameter | Description |
| set | Required. The set to return the difference between. |
Return Value
| Type | Description |
| Set | A set object with the difference of the two sets. |
Set Logic Metods:
See Also:
Browser Support
The difference() 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 |