find string in array javascript
var fruits = ["Banana", "Orange", "Apple", "Mango"];
var n = fruits.includes("Mango");var myarr = ["I", "like", "turtles"];
var arraycontainsturtles = (myarr.indexOf("turtles") > -1);function checkInput(input, words) {
return words.some(word => input.toLowerCase().includes(word.toLowerCase()));
}
console.log(checkInput('"Definitely," he said in a matter-of-fact tone.',
["matter", "definitely"]));search = (arr, item) => { return arr.indexOf(item); }function checkInput(input, words) {
return words.some(word => new RegExp(word, "i").test(input));
}
console.log(checkInput('"Definitely," he said in a matter-of-fact tone.',
["matter", "definitely"]));
Also in JavaScript:
- what is package.json
- javascript get remaining time from start and end datetime
- go back doesnt load javascript safari
- searchbox in api news in angular
- javascript closure function example
- node log centered
- phantomjs in angular
- react-router react-router-dom
- get serialize data javascript
- recieve voice channel audio discord.js
- javascript redirect to another page
- delay in javascript
- js narrate text
- vuejs my chart load before fetch data
- how to use jq with json data
- how to get code suggestions for react components
- javascript print object pretty
- hi;ight word in textarea javascript
- javascript empty function
- javascript remove last element from array
- cannot create an instance of an abstract class httphandler angular
- spreadjs autofit column with minimum
- span change jquery
- js extract all tags not have attr