javascript check if in array
var extensions = ["image/jpeg","image/png","image/gif"];
if(extensions.indexOf("myfiletype") === -1){
alert("Image must be .png, .jpg or .gif");
}
How to Check if an Item is in an Array in JavaScript Using Array.includes()
const nums = [ 1, 3, 5, 7];
console.log(nums.includes(3));
// true