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