suntongjian

1、 Array.isArry()方法 ,返回布尔值

console.log(Array.isArray([]))

2、 instanceof方法 ,返回布尔值

console.log([] instanceof Array)

3、 constructor方法 判断

console.log([].constructor == Array)

4、 使用Object.prototype.toString()方法 判断

function isArray(arr){
  return Object.prototype.toString.call(arr) == "[object Array]" 
}
console.log(isArray([]))

 

分类:

技术点:

相关文章:

  • 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
相关资源
相似解决方案