判断一个Object是否为数组Array的方法

时间:2023-03-09 19:24:26
判断一个Object是否为数组Array的方法

1.constructor

constructor 属性是每个有原型对象的原型成员

arr.constructor == Array  //true说明arr是数组

2.isArray

arr.isArray()

3.length

4.prototype

相关文章