Opens in a new tab
A picture of Jeff Brigman
I CODE TODAY FOR
A BETTER TOMORROW

Glossary Term

Set.prototype.symmetricDifference()

2 tags 1 category

The symmetricDifference() method of Set instances takes a set and returns a new set containing elements which are in either this set or the given set, but not in both.

In mathematical notation, symmetric difference is defined as:

A⊖B=(A∖B)∪(B∖A)Aominus B = (Asetminus B)cup(Bsetminus A)

!A Venn diagram where two circles overlap. The symmetric difference of A and B is the region contained by either circle but not both.

symmetricDifference() accepts set-like objects as the other parameter. It requires this to be an actual Set instance, because it directly retrieves the underlying data stored in this without invoking any user code. Then, it iterates over other by calling its keys() method, and constructs a new set with all elements in this that are not seen in other, and all elements in other that are not seen in this.

Syntax example: symmetricDifference(other)

Term Connections

Explore related terms connected by shared tags, shared categories, and relationship phrases. This map loads only when it comes into view.

Loading term connections…