frontend-coder

1. array instanceOf Array

2. Array.prototype.isPrototype(array)

3. Object.getPrototype(array) === Array.prototype

4. array.constructor === Array

5. Object.prototype.toString.call(array) === \'[object Array]\'

6. Array.isArray(array)

 

PS: 

  [].toString()  === "";  (注意不是 " " 或者 \' \');

  Object.prototype.toString.call([]) === \'[object Array]\';

  两个值的不同是因为在 Array.prototype 里面对 toString 方法进行了重写;  Array.prototype.hasOwnproperty(\'toString\') === true

分类:

技术点:

相关文章:

  • 2021-11-20
  • 2021-11-20
  • 2022-01-03
  • 2021-11-30
  • 2021-11-20
  • 2021-11-20
  • 2021-11-27
  • 2021-06-05
猜你喜欢
  • 2021-11-20
  • 2021-11-20
  • 2021-11-20
  • 2021-11-20
  • 2021-11-20
  • 2021-11-20
  • 2021-11-20
相关资源
相似解决方案