![]() |
VOOZH | about |
Lodash _.unionBy() method accepts iteratee which is invoked for each element of each array to generate the criterion by which uniqueness is computed. The order of result values is determined from the first array in which the value occurs.
_.unionBy(array, [iteratee = _.identity]);Example 1: In this example, we are combining multiple arrays of objects by using the _unionBy() method.
Output:
[ { 'y': 1 }, { 'y': 2 }, {'y': 3} ]Example 2: In this example, we are combining multiple arrays by using the _unionBy() method.
Output:
[1.5, 2.6, 3.8]