indexOf():返回某个指定的字符串值在字符串中首次出现的位置。
var str ="Hello world!";
var res = str.indexOf("o");
console.log(res);//打印7
lastIndexOf():从后向前搜索指定字符串出现的最后位置。
var res = str.lastIndexOf("o");
console.log(res);//打印7 两个o,我们找的是o最后一次出现的位置