? ? ? ? 基本(值)类型? ? ? ? ? string、boolean、number、undefined、null、symbol
? ? ? ? 对象(引用)类型? ? ? Object
? ? ? ? typeof? ?返回类型的字符串形容: "object"、"string"、"boolean"、 "number"、 "undefined"、 ????????????????????"symbol"、 "function"
? ? ? ? instanceof? ? 返回布尔值判断对象类型? ? ?用于测试构造函数的prototype属性能否出现在对象? ? ? ? ? ????????????????????????的原型链中的任何位置? ? ? ?
? ? ? ? ===
? ? ? ? ? ? typeof? 'str'? ? ? ? ? ? ? //? ? "string"
? ? ? ? ? ? typeof 1? ? ? ? ? ? ? ? ?// "number"
? ? ? ? ? ? typeof true? ? ? ? ? ? // "boolean"
? ? ? ? ? ? typeof Symbol(1)? ? // "symbol"
? ? ? ? ? ? typeof function(){}? ? ? ? // "function"
? ? ? ? ? ? typeof {}? ? ? ? ? ? ? ? ? ? // "object"
? ??????????? typeof []? ? ? ? ? ? ? ? ? // "object"
? ? ? ? ? ? typeof undefined? ? ? ? // "undefined"
? ? ? ? ? ? typeof null? ? ? ? ? ? ? ? ?//? "object"
? ? ? ? ? ? [] instanceof Array? ? ? ? ? ? ? ? //true
? ? ? ? ? ? "abc" instanceof String? ? ? ? //false? ? ? ? ? ? ? ? ?此时的"abc"是基础类型
? ? ? ? ? ? new String("abc") instanceof String? ?//true? ? ? 此时为引用类型
? ??????????new Date() instanceof Date? ? ? ? ? //true
? ??????????(function(){}) instanceof Function? ? ? //true
? ? ? ? ? ? var a =null;
? ? ? ? ? ? a === null? ? ? ? ? ? ?//true? ? ? ? ? ? 判断null
? ? ? ? ? ? a = undefined;
? ? ? ? ? ? a === undefined? ? //true? ? ? ? ?判断undefined
typeof 判断基本类型、函数没有问题? ? ? ? ? 但是对于null有坑,会返回"object"
instanceof? 判断对象实例的类型场景比较合适
===? ? ? ? ? ? ? 判断单一值得类型有用如:null、undefined? ??
? ? ? ? ? ?
? ??