目录
一、typeof():判断简单数据类型
简单数据类型:数值、字符串、符号、布尔值、null、undefined
用法:
let a=[1,2]
typeof(a) //=====>Object
-----------------------------------------------------
let b={"npm":"wp"}
扫描二维码关注公众号,回复: 14617420 查看本文章typeof(b) //========>Object
-----------------------------------------------------
let c="hhw"
typeof(c) //========>String
................
二、instanceof:判断复杂数据类型
复杂数据类型:对象、数组
用法:
let a=[1,2]
a instanceof Array //=====>true
a instanceof Object //=====>true
---------------------------------------------------------
let b={"npm":"wp"}
b instanceof Object //========>true
---------------------------------------------------------
let c="hhw"
c instanceof String //========>false
................