There was an error while loading. Please reload this page.
Gives union of first array with another.
Alternatives: compare, compare-update, map, map-update.
array.union(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.union(x, [2, 3, 5]); // [1, 2, 3, 4, 5] var x = [1, 2, 3, 4]; array.union(x, [-2, -3, -5], (a, b) => Math.abs(a) - Math.abs(b)); // [1, 2, 3, 4, -5]