笔记:http://www.imooc.com/learn/277

一、tyopeof

返回的是一个string
JS中的类型检测

typeof null===object是一个特例

二、instanceof

但是当你想判断类型是否为数组是就不方便用typeof,因为只会返回object,这时候就要用到instanceof。一种基于原型链的判断方法。
返回boolean

JS中的类型检测

三、Object.prototype.toString

JS中的类型检测

总结:

JS中的类型检测

相关文章:

  • 2021-06-02
  • 2021-12-25
  • 2021-11-20
  • 2021-12-25
  • 2021-05-18
  • 2021-11-30
  • 2022-12-23
猜你喜欢
  • 2021-04-12
  • 2021-05-12
  • 2021-09-17
  • 2022-12-23
  • 2021-12-25
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案