check if a variable is array in javascript
snippet in javascript

check if var is array js

user8588

Array.isArray(variableName)

js test if array

user8597

if(Array.isArray(myVarToTest)) {
	// myVatToTest is an array
} else {
	// myVarToTest is not an array
}

check if a variable is array in javascript

user7885

// inside if else check
if(Array.isArray(myVarToTest)) {
	// myVatToTest is an array
} else {
	// myVarToTest is not an array
}

javascript check if is array

user3157

var colors=["red","green","blue"];

if(Array.isArray(colors)){
    //colors is an array
}