1. 在进行字符串中是否含有某个指定字符或值判断时候,除了可以通过indexOf和正则匹配,还可以通过最新的includes进行判断。如下:
const a = 'pc/h5/test' const b = a.includes('/h5/') console.log(b) // true