JavaScript Array содержит
var colors = ["red", "blue", "green"];
var hasRed = colors.includes("red"); //true
var hasYellow = colors.includes("yellow"); //false
Grepper
var colors = ["red", "blue", "green"];
var hasRed = colors.includes("red"); //true
var hasYellow = colors.includes("yellow"); //false
var myList=["a", "b", "c"];
mylist.includes("d")//returns true or false
var fruits = ["Banana", "Orange", "Apple", "Mango"];
var n = fruits.includes("Mango");
if(["code","padding",".com"].includes("code")){
// statement if true
}else{
// statement if flase
}
var fruits = ["Banana", "Orange", "Apple", "Mango"];
var n = fruits.includes("Mango");
var boolValue = array.includes(item);