JS判断字符串中是否包含数组的某一项

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

你可能感兴趣的:(javascript,前端)