代码语言:javascript复制1. Array.isArray([]) // true

2. Object.prototype.toString.call([]) // '[object Array]'

3. [].constructor ===Array // true

4. [] instanceof Array // true

5. [].__proto__ === Array.prototype // true

6. Array.prototype.isPrototypeOf([]) // true

7. Object.getPrototypeOf([]) === Array.prototype // true

以上方法中,1和 2 绝对靠谱,其他方法会受原型链被修改的影响,使用时注意。