![]() |
VOOZH | about |
The _.sortedLastIndexOf method is used to return the highest index of the array where an element can be inserted and maintain its sorted order. Also, this method is like _.lastIndexOf except that it performs a binary search on a sorted array.
Syntax:
_.sortedLastIndexOf(array, value)Parameters: This method accepts two parameters as mentioned above and described below:
Return Value: It returns the index of the matched value, else -1.
Example 1: Here, const _ = require(‘lodash’) is used to import the lodash library into the file.
Output:
4Example 2:
Output:
7