-
Notifications
You must be signed in to change notification settings - Fork 5
intersection
Subhajit Sahu edited this page Mar 17, 2020
·
26 revisions
Gives values of an array present in another.
array.intersection(x, y, [fn]);
// x: an array
// y: another array
// fn: compare function (a, b)
const array = require('extra-array');
var x = [1, 2, 3, 4];
array.intersection(x, [2, 3, 5]);
// [2, 3]
array.intersection(x, [-2, -3, -5], (a, b) => Math.abs(a) - Math.abs(b));
// [2, 3]