es6处理字符串(indexOf、startsWith、endsWith、includes)

字符串查找 str.indexOf(searchValue[, fromIndex]) 之前用indexOf来查找字符串是否存在,并返回索引位置,当不存在时返回-1。 例:javascript let str = 'How are you'; console.log(str.indexOf('no')) // -1 此时咱们就根据这个返回值是否为-1来判断字符串是否存在, 固然为了简便,咱们也会用
相关文章
相关标签/搜索