let a =[];if(a &&(typeof a ==='object')&&(a instanceofArray)){
console.log('a is Array');}
2、使用typeof + constructor
let a =[];if(a &&(typeof a ==='object')&&(a.constructor === Array)){
console.log('a is Array');}
3、使用Object.prototype.toString.call
let a =[];if(a && Object.prototype.toString.call(a)==='[object Array]'){
console.log('a is Array');}
4、使用数组特性进行判断
let a =[];if(a &&typeof a ==='object'&&typeof a.length ==='number'&&typeof a.splice ==='function'&&!(a.propertyIsEnumerable('length'))){
console.log('a is Array');}
js判断数组类型的方法总结1、使用typeof + instanceoflet a=[];if (a && (typeof a === 'object') && (a instanceof Array)) { console.log('a is Array');}2、使用typeof + constructorlet a=[];if (a && (typeof a === 'object') && (a.constructor