javascript check if in array

JavaScript
var colors = ["red", "blue", "green"];
var hasRed = colors.includes("red"); //true
var hasYellow = colors.includes("yellow"); //falsevar extensions = ["image/jpeg","image/png","image/gif"];          
if(extensions.indexOf("myfiletype") === -1){
	alert("Image must be .png, .jpg or .gif");
} var fruits = ["Banana", "Orange", "Apple", "Mango"];
var n = fruits.includes("Mango");
 
Source

Also in JavaScript: