sortedLastIndexOf source npm

_.sortedLastIndexOf(array, value)

这个方法类似 _.lastIndexOf,除了它是执行二进制来检索已经排序的数组的。

参数

  1. array (Array)

    需要检索的数组

  2. value (*)

    要评估位置的值

返回值 (number)

返回匹配值的 index ,否则返回 -1.

示例

_.sortedLastIndexOf([1, 1, 2, 2], 2);
// => 3