javascipt判断类型的方法 typeof() // instanceof
console.log(typeof(a)) // undefined 因为a未定义
console.log(typeof(typeof(a)))
// String 因为typeof(a)返回的undefined是字符串类型
typeof(null) //Object
instanceofo判断是否在构造函数的原形链上
hd = []
console.log(hd instanceof Array)
// true
// 未定义的变量是false
判断类型
var a;
if (a!='' && a!= undefined && a!= null) {}
//简写
if (!!a) {}
!! 代表着 不等于 空/undefined/null
只有 空/undefined/null 返回的是true 其他全部都是false
引用类型转换布尔类型 为true
if ([]) {console.log(为真)}