javascript if string includes in array code example
Example 1: 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");
}
Example 2: see if array contains array javascript
const found = arr1.some(r=> arr2.indexOf(r) >= 0)