To check if a string contains text from an array of substrings in JavaScript, we can use the some and includes method.
For instance, we write
if (substrings.some((v) => str.includes(v))) {
// ...
}
to call some on the substrings array with a callback that calls str.includes with the v entry being looped through in substrings to check if v is in the str string.
If any value v is in str, then some returns true.