Answers for "js string contains string from array"

3

js check if string includes from array

wordsArray = ['hello', 'to', 'nice', 'day']
yourString = 'Hello. Today is a nice day'.toLowerCase()
result = wordsArray.every(w => yourString.includes(w))
console.log('result:', result)
Posted by: Guest on October-13-2021
1

js check if string includes from array

const found = arrayOfStrings.find(v => str.includes(v));
Posted by: Guest on October-13-2021
0

js array string includes

if (new RegExp(substrings.join("|")).test(string)) {
    // At least one match
}
Posted by: Guest on July-15-2021

Code answers related to "TypeScript"

Browse Popular Code Answers by Language