Method Array.disjoint
Check whether two arrays are disjoint
-
Syntax
Boolean Array.disjoint([ Array a ])
This functions checks whether two arrays are disjoint. If no element is in more than one array then the arrays are considered to be disjoint. -
Parameters
Array a(Optional)- The array to check for disjoint elements
- Return value True if the arrays comared are disjoint; false otherwise
-
Examples
- To check whether the arrays (0,1,2) and (-4,1,8) are disjoint.
// Define array 1 var a1 = [0,1,2]; // Define array 2 var a2 = [-4,1,8]; // Output is false as a1 and a2 share element with value 1 a1.disjoint(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.
