This commit is contained in:
qianguyihao 2021-03-18 20:10:43 +08:00
parent 097f41fe80
commit e78e6d9879

View File

@ -154,9 +154,11 @@ console.log('a 出现的次数是: ' + num);
const name = 'qianguyihao'; const name = 'qianguyihao';
console.log(name.search('yi')); // 打印结果6 console.log(name.search('yi')); // 打印结果6
console.log(name.search(/\yi/i)); // 打印结果6 console.log(name.search(/yi/i)); // 打印结果6
``` ```
备注上方的`/yi/i`采用的是正则表达式的写法意思是 name去匹配字符`yi`忽略大小写
### 3includes()字符串中是否包含指定的内容 ### 3includes()字符串中是否包含指定的内容