本题可以使用split进行分割 const _searchStrIndexOf = (str, target) => { // 补全代码 return str.split(target).length-1 }