I have a list of strings
var list = ['my name is', 'people call me', 'i am', 'you can call me'];
I'd like to check if a text contains at least one expression from my list of strings before executing an if statement
if (text.toLowerCase().contains("my name is") ||
text.toLowerCase().contains("people call me") || text.toLowerCase().contains("i am")) {
//do something
}
Right now this is what I'm doing but it won't work in the long run as my list will get longer
I need to return true if text.contains(anyStringfromMyList)
Edit :
Also I'd like to know (return) which item from this list was found in the text