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

This function is valid in v2.1.0 to v2.20.0. This function has been downloaded 22 times.


{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.


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

Required Functions

This function requires the following functions which are included automatically:

  • slice()
    Slice does not modify the original array, but instead returns a shallow copy of elements from the original array.
  • 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.