difference source npm

_.difference(array, [values])

Creates an array of unique array values not included in the other provided arrays using SameValueZero for equality comparisons.

Arguments

  1. array (Array)

    The array to inspect.

  2. [values] (...Array)

    The values to exclude.

Returns (Array)

Returns the new array of filtered values.

Example

_.difference([3, 2, 1], [4, 2]);
// => [3, 1]