Use Array.isArray(variable) to check if a variable is an array.
Array.isArray(variable)
console.log(Array.isArray([1, 2, 3])); // true