Arrays.difference()
Syntax
function difference<T>(...arrays: readonly T[][]): T[]
Creates a new array with only the elements that are unique to one of the given arrays.
Parameters | |
arrays
Rest
|
The arrays to difference. |
Example
import { Arrays } from 'potence';
const array1 = [0, 1, 2, 3];
const array2 = [2, 3, 4, 5];
Arrays.difference(array1, array2); // -> [0, 1, 4, 5]
Remarks
The resulting array will contain all elements except those shared by multiple of the given arrays.