Skip to content

intersection

Subhajit Sahu edited this page Jun 13, 2020 · 16 revisions

Gives values present in both sets. 🏃 📼 📦 🌔 📒

Alternatives: intersection, intersection$.
Similar: union, intersection, difference, symmetricDifference, isDisjoint.

set.intersection(x, y);
// x: a set
// y: another set
const set = require('extra-set');

var x = new Set([1, 2, 3, 4]);
var y = new Set([2, 3, 5]);
set.intersection(x, y);
// Set(2) { 2, 3 }

references

Clone this wiki locally