Gives the position of the last occurrence of the string passed as parameter in the current string.
给出作为参数传递的当前字符串中最后一次出现的字符串的位置。
Returns -1
if the search string is not found.
如果找不到搜索字符串,则返回-1
。
'JavaScript is a great language. Yes I mean JavaScript'.lastIndexOf('Script') //47
'JavaScript'.lastIndexOf('C++') //-1
Also see indexOf()
.
另请参见indexOf()
。