_.findIndex(查找元素索引值)
Last updated
Was this helpful?
Last updated
Was this helpful?
语法:
源代码链接:
npm包链接:
描述:
这个方法l类似于,但是只是返回差找到第一次的索引值,而不是返回值本身。
开始版本:1.1.0
参数:
array (Array)
: 需要检索的数组。
[predicate=_.identity] (Function)
: 每个迭代函数调用。
[fromIndex=0] (number)
: 开始搜索的索引值。
返回值:
(number)
: 返回查找到的元素索引值,否则f返回 -1
。
例子:
注意:不同的方式代表:_.matches
,_.matchesProperty
,_.property
的简写法