![]() |
VOOZH | about |
Lodash _.sortedLastIndexBy() method is used to return the highest index of the array where an element can be inserted and maintain its sorted order. In addition, it accepts iteratee which is invoked for value and each element of the array to compute their sort ranking.
_.sortedLastIndexBy(array, value, [iteratee=_.identity]);Example 1: In this example, we are getting the index at which we can insert the given value into the given array.
Output:
1Example 2: In this example, we are getting the index at which we can insert the given value into the given array.
Output:
2Note: This will not work in normal JavaScript because it requires the library lodash to be installed.