Identifies the base type of array elements
Two or more arrays to intersect
A new array containing elements common to all arrays
arrIntersection([1, 2, 3], [2, 3, 4]); // [2, 3]
arrIntersection([1, 2, 3], [2, 3], [3, 4]); // [3]
arrIntersection(["a", "b"], ["b", "c"]); // ["b"]
arrIntersection([1, 2], [3, 4]); // []
arrIntersection([1, 2, 3], []); // []
// Array-like objects
arrIntersection({ length: 3, 0: 1, 1: 2, 2: 3 }, [2, 3]); // [2, 3]
The arrIntersection() method returns a new array containing elements that exist in all provided arrays. Uses strict equality (===) for comparison and maintains order from the first array.