Arrays.intersection()
Syntax
function intersection<T>(...arrays: readonly T[][]): T[]
Creates a new array with only the elements that are common to all of the given arrays.
Parameters | |
arrays
Rest
|
The arrays to intersect. |
Example
import { Arrays } from 'potence';
const array1 = [0, 1, 2, 3];
const array2 = [2, 3, 4, 5];
Arrays.intersection(array1, array2); // -> [2, 3]