Method Array.diff
Get the difference of n arrays
-
Syntax
Array Array.diff([ Array a0 ... an ])
The difference is computed as the elements which are in the calling array but not in the arrays passed as arguments. Duplicates are removed from the result. -
Parameters
Array a0 ... an(Optional)- The arrays to compute the difference from.
-
Return value
A new array with those elements which are not in arrays
a0troughan. -
Examples
- To get the difference bewteen (0,1,2) and the arrays (0,4,5) and (0,5,6,2);
// Define array 1 var a1 = [0,1,2]; // Define array 2 var a2 = [0,4,5]; // Define array 3 var a3 = [0,5,6,2]; // Output is (1) a1.diff(a2,a3);
-
Download
Source
Unless otherwise noted all code in the JSLab Standard Library is licensed as GPLv3. See http://www.gnu.org/licenses/gpl.html for the entire license.
This function has dependencies and will not work stand-alone. Use the download button above instead of copy/paste.
