how to check an array contains a value in javascript 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: javascript array contains
var colors = ["red", "blue", "green"];
var hasRed = colors.includes("red");
var hasYellow = colors.includes("yellow");
Example 3: javascript is int in array
[1, 2, 3].includes(2);
[1, 2, 3].includes(4);
[1, 2, 3].includes(1, 2);