_.indexOf(获取元素的索引值)
Last updated
Was this helpful?
Last updated
Was this helpful?
语法:
源代码链接:
npm包链接:
描述:
使用等值比较,返回首次value
在数组array
中被找到的 索引值, 如果fromIndex
为负值,将从数组array
尾端索引进行匹配。
开始版本:0.1.0
参数:
array (Array)
: 需要查找的数组。
value (*)
: 需要查找的值。
[fromIndex=0] (number)
: 开始查询的位置。
返回值:
(number):
返回 值value在数组中的索引位置, 没有找到为返回-1。
例子: