1function searchStringInArray (str, strArray) {
2 for (var j=0; j<strArray.length; j++) {
3 if (strArray[j].match(str)) return j;
4 }
5 return -1;
6}
7
1var fruits = ["Banana", "Orange", "Apple", "Mango"];
2
3var n = fruits.includes("Mango");
1var myarr = ["I", "like", "turtles"];
2var arraycontainsturtles = (myarr.indexOf("turtles") > -1);
1function checkInput(input, words) {
2 return words.some(word => input.toLowerCase().includes(word.toLowerCase()));
3}
4
5console.log(checkInput('"Definitely," he said in a matter-of-fact tone.',
6["matter", "definitely"]));
1function checkInput(input, words) {
2 return words.some(word => new RegExp(word, "i").test(input));
3}
4
5console.log(checkInput('"Definitely," he said in a matter-of-fact tone.',
6["matter", "definitely"]));