数组 判断是否是数组

var arr = [1,2,3,4,5,1,2,3,4,5];
// 判断是否是数组
// ES5提供Array.isArray, isArray是Array构造器上面的
console.log(Array.isArray(arr)); // true

// 2,用 [] instanceof Array 判断,Array是构造器的意思
console.log(arr instanceof Array); // true

// 3, 用object.prototype.toString的方法
console.log(({}).toString.apply(arr) === '[object Array]'); // true
// 4
console.log(arr.constructor === Array); // true
原文地址:https://www.cnblogs.com/luckstart/p/5197196.html