You can use the .some
method referenced here.
The
some()
method tests whether at least one element in the array passes the test implemented by the provided function.
// test cases
var str1 = 'hi, how do you do?';
var str2 = 'regular string';
// do the test strings contain these terms?
var conditions = ["hello", "hi", "howdy"];
// run the tests against every element in the array
var test1 = conditions.some(el => str1.includes(el));
var test2 = conditions.some(el => str2.includes(el));
// display results
console.log(str1, ' ===> ', test1);
console.log(str2, ' ===> ', test2);
_x000D_