1 var isArray = function(arr){ 2 return typeof Array.isArray === "function" ? Array.isArray(arr) : Object.prototype.toString.call(arr) === "[object Array]"; 3 }; 4 var arr = [1, 2, 3, 4]; 5 console.log(isArray(arr));