![]() |
VOOZH | about |
Lodash _.sortedUniqBy method is used to return the lowest index of the array where an element can be inserted and maintain its sorted order. Also, this method is like _.uniqBy except that it's designed and optimized for sorted arrays.
_.sortedUniqBy(array, [iteratee]);This method is used to return the new duplicate free array.
Example 1: In this example, we are getting an array that has unique elements by the use of the lodash _.sortedUniqBy() method.
Output:
[1.1, 2.1, 3.5]Example 2: In this example, we are getting an array that has unique elements by the use of the lodash _.sortedUniqBy() method.
Output:
[112.1, 112.1, 132.5]Note: This will not work in normal JavaScript because it requires the library lodash to be installed.