Identifies the base type of array elements
A new array containing elements only in the source array
arrDifference([1, 2, 3, 4], [2, 4]); // [1, 3]
arrDifference([1, 2, 3], [2], [3]); // [1]
arrDifference(["a", "b", "c"], ["b"]); // ["a", "c"]
arrDifference([1, 2, 3], []); // [1, 2, 3]
arrDifference([], [1, 2]); // []
// Array-like objects
arrDifference({ length: 3, 0: 1, 1: 2, 2: 3 }, [2]); // [1, 3]
The arrDifference() method returns a new array containing elements from the first array that do not exist in any of the other provided arrays. Uses strict equality (===) for comparison.