String.lastIndexOf() 會回傳指定子字串最後一次出現的索引。
var str = 'one two one'; str.lastIndexOf('one');
若找不到,會回傳 -1。
它可以搭配 fromIndex 參數,從指定位置向前搜尋。