The _.differenceBy() method is used to remove the values from the original array by iterating over each element in the array by using the Iteratee function. It is almost same as _.difference() function.
lodash.differenceBy(array, [values], [iteratee=_.identity])
Parameters: This function accepts three parameters as mention above and describe below
- array: This is the array from which the values are to be removed.
- values: It is the Array of values that is to be removed from the original array.
- Iteratee: This is the function that iterate over each element.
Note: If the iteratee function is not given then _.differenceBy() function act as _.difference() function.
Return Value: This function returns an array.