This method is like sortedIndex except that it returns the highest index at which value should be inserted into array in order to maintain its sort order.
sortedIndex
value
array
The sorted array to inspect.
The value to evaluate.
Returns the index at which value should be inserted into array.
5.11.0
sortedLastIndex([4, 5, 5, 5, 6], 5)// => 4 Copy
sortedLastIndex([4, 5, 5, 5, 6], 5)// => 4
This method is like
sortedIndex
except that it returns the highest index at whichvalue
should be inserted intoarray
in order to maintain its sort order.