Method Array.union
Get the union of n arrays
-
Syntax
Array Array.union([ Array a0 ... an ])
This function will return the union of the array calling the method and any number of arrays passed as arguments. Duplicates are removed from the result. -
Parameters
Array a0 ... an(Optional)- The arrays to include in the union.
- Return value A new array containing the union of (unique) elements.
-
Examples
- To get the union between (0,1,2), (3,4,5) and (4,5,6)
// Define array 1 var a1 = [0,1,2]; // Define array 2 var a2 = [3,4,5]; // Define array 3 var a3 = [4,5,6]; // Output is (1,2,3,4,5,6) a1.union(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.
