javascipt判断类型的方法 typeof() // instanceof

    1. console.log(typeof(a)) // undefined 因为a未定义
    2. console.log(typeof(typeof(a)))
    3. // String 因为typeof(a)返回的undefined是字符串类型
    4. typeof(null) //Object

    instanceofo判断是否在构造函数的原形链上

    1. hd = []
    2. console.log(hd instanceof Array)
    3. // true
    4. // 未定义的变量是false

    判断类型

    1. var a;
    2. if (a!='' && a!= undefined && a!= null) {}
    3. //简写
    4. if (!!a) {}

    !! 代表着 不等于 空/undefined/null
    只有 空/undefined/null 返回的是true 其他全部都是false

    引用类型转换布尔类型 为true

    1. if ([]) {console.log(为真)}