differenceBy
Returns the difference between two arrays, after applying the provided function to each array element of both.
- Create a
Setby applyingfnto each element inb. - Use
Array.prototype.map()to applyfnto each element ina. - Use
Array.prototype.filter()in combination withfnonato only keep values not contained inb, usingSet.prototype.has().