Loading lesson path
Concept visual
Start at both ends
In JavaScript 2025, 7 new logical methods were added to the Set object: union() difference() intersection() isDisjointFrom() isSubsetOf() isSupersetOf() symmetricDifference()
Set Logic is an ECMAScript 2025 feature. JavaScript 2025 is fully supported in all modern browsers since
136
136
129
18.2
120
method returns the union of two sets.
method returns a new set containing the elements which are in this set, or in the argument set, or in both:
const A = new Set(['a','b','c']);
const B = new Set(['b','c','d']);
const C = A.union(B);method returns the intersection of two sets.
method returns a new set containing the elements which are in this set and in the argument set:
const A = new Set(['a','b','c']);
const B = new Set(['b','c','d']);
const C = A.intersection(B);method returns the difference between two sets.
method returns a new set containing elements which are in this set but not in the argument set: