Skip to content

Latest commit

 

History

History

lastIndexOf

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

介绍

lastIndexOf(),给定一元素,查找并返回其最后一个索引,没找到则返回 -1。

MDN 参考

语法

arr.lastIndexOf(valueToFind[, fromIndex])

参数

valueToFind
待查的元素
fromIndex(可选)
查找的起始位,默认为数组长度 -1。若为负数,则从末尾数起

返回值

找到则返回索引,否则返回 -1。