check if array has js code example
Example 1: js test if array
if(Array.isArray(myVarToTest)) {
// myVatToTest is an array
} else {
// myVarToTest is not an array
}
Example 2: js check if is array
if(Array.isArray(colors)){
//colors is an array
}