javascript check if array does not contain value code example
Example 1: check if array does not contain value javascript
var fruits = ["Banana", "Orange", "Apple", "Mango"];
var n = fruits.includes("Mango");
var n = fruits.includes("Django");
Example 2: check value exist in array javascript
[1, 2, 3].includes(2);
[1, 2, 3].includes(4);
[1, 2, 3].includes(1, 2);
Example 3: check if array does not contain string js
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"]));