diffArrays()

Creates a new array which is the difference of the two given arrays.

This function is valid in v2.1.0 to v2.24.3. This function has been downloaded 61 times.

Parameters

{Array} array1
Array containing the values that will be returned if they are not found in array2.
{Array} array2
Array whose values will be compared to those in array1 and only those that appear in array1 and not in this array will be returned.

Returns

{Array}
A new array with values from array1 that are not in array2.

Required Functions

This function directly requires the following functions which are included automatically:

  • is()
    Tests to see if two or more values are exactly the same. This is similar to === but will also indicate that NaN is NaN and will indicate that -0 is not 0.
  • slice()
    Slice does not modify the original array, but instead returns a shallow copy of elements from the original array.

Requiring Functions

This function is directly required by the following functions:

  • intersect()
    Gets a new array that will be the intersection of two arrays.
  • union()
    Creates a new array which will contain all of the items of the two given arrays. Different from concatenation because the number of times a value occurs will never exceed the maximum number of times it was found in one of the arrays.