美文网首页
JS - typeof 和 instanceof

JS - typeof 和 instanceof

作者: 恒星的背影 | 来源:发表于2018-09-27 22:01 被阅读0次
typeof
Undefined "undefined"
Null "object"
Boolean "boolean"
Number "number"
String "string"
Symbol "symbol"
函数对象 "function"
其它对象 "object"

instanceof 运算符用于测试构造函数的 prototype 属性是否出现在对象的原型链中的任何位置

a = new Number(5)
a instanceof Number   // true
a instanceof Object   // true

相关文章

网友评论

      本文标题:JS - typeof 和 instanceof

      本文链接:https://www.haomeiwen.com/subject/uukonftx.html