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

Glossary Term

Set.prototype.difference()

2 tags 1 category

The difference() method of Set instances takes a set and returns a new set containing elements in this set but not in the given set.

A∖B={x∊A∣x∉B}Asetminus B = \{xin Amid xnotin B\}

!A Venn diagram where two circles overlap. The difference of A and B is the part of A that is not overlapping B.

difference() 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, its behavior depends on the sizes of this and other:

Syntax example: difference(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…