checks if a number is in an array js 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: how to Check if an array contains a string
const colors = ['red', 'green', 'blue'];
const result = colors.includes('red');
console.log(result);
const colors = ['Red', 'GREEN', 'Blue'];
const result = colors.map(e => e.toLocaleLowerCase())
.includes('green');
console.log(result);