let arr = ['Hello','hi','John'];
let string1 = "Hello, what`s your name";
arr.every(str => string1.includes(str)) //-> true
||
let string1 = "Hi, what`s your name";
arr.some(str => string.includes(str)) //-> false
JS判断字符串中是否包含数组的某一项
最新推荐文章于 2024-03-13 17:27:24 发布