判断数据类型

116 阅读1分钟

typeof

可以判断:undefinde/数值/字符串/布尔值/function
不可以判断:null与object object与array 这4个均会判断为object类型

instanreof

判断对象的具体类型

===

判断null与undefinde(注意null===undefined为false 而null==undefined为true)