Array.prototype.exclusive >= 0.1.0
Purpose
Get all the values that are either in the first or in the second array, but not in both
Syntax
Array#exclusive
(
Arrayarr
Functioncast_function
);
Parameters
arr
- The array to test against
cast_function
- Function to use to cast values
Return values
Array
New array
Examples
var a = [0,1,2,47,99,100],
b = [2,47,55,96,200];
a.exclusive(b);>>> [0, 1, 99, 100, 55, 96, 200]
// The order does not matter
b.exclusive(a);>>> [0, 1, 99, 100, 55, 96, 200]
Comments