cheak type of array code example
Example 1: in javascript check is is an array or not
Array.isArray(yourItem)
Example 2: 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");
}