indexOf 从头开始找,返回目标的索引值
lastIndexOf 从尾开始找,返回目标的索引值(注意这个索引值是从头往后数的)
如未找到,返回-1
eg:
var num=[1,2,3,4,5,4,3,2,1,0,-3,6]
num.indexOf(4) //3
num.lastIndexOf(4)//5
num.indexOf(4,4) //5
alert(num.lastIndexOf(4,4))//3
alert(num.lastIndexOf(4,5))//5
alert(num.lastIndexOf(4,6))//5