我正在尝试使用.includes()
方法判断一个字符串是否包含存储在数组中的多个字符串。
因此,我尝试了以下代码:
let string = 'hello james';
console.log(string.includes(['hello', 'james']));
但是返回的却是false
...当我知道字符串包含'hello'或'james'时,这是可能的吗??我如何判断一个字符串是否包含单词'hello'或'james'
因此,伪代码应该是string.includes('hello' || 'james');
string.includes('hello'||'james');
- Smokey Dawson