一.indexOf() 1.定义 indexOf()方法返回String对象第一次出现指定字符串的索引,若未找到指定值,返回-1.(数组同一个概念) 2.语法 str.indexOf(searchValue[, fromIndex]) searchValue:字符串对象中被查找的值. fromIndex:开始查找的索引,默认为0. 3.示例 let str = 'Hello, indexOf!'; console.log(str.indexOf('Hello')); // 0 console.l…