![]() |
VOOZH | about |
Lodash _.intersectionBy() is used to take the intersection of the array with any number of arrays based on some function that iterates over each element of the array. It returns the array after doing the intersection of the arrays.
_.intersectionBy([arrays], [iteratee=_.identity]);Example 1: In this example, we are getting the intersection of two arrays by the use of the lodash _.intersectionBy() method.
Output:
👁 ImageExample 2: In this example, we are getting the intersection of two arrays and also printing those values only which are closer to Math.ceil by the use of the lodash _.intersectionBy() method.
Output:
👁 ImageExample 3: In this example, we are getting the intersection of two arrays by the use of the lodash _.intersectionBy() method. When multiple common elements are present it return them only one times and no duplicates are returned in the array.