1.非空判断
1)变量是null,undefined,0,"";if判断都为false
如:var t = null;
t? true: false; // false
2)变量是个空字符串,不为null var t = ""; t ? true: false; //false t != null; // true 3)变量是多个空格 var t = " "; t ? true: false; //true t != null; // true (t && t != null && $.trim(t) != "")? true: false; //false
4)0和''比较
0 == ''; //true
0 === ''; //false
2.对象判断
var t = {"a":1,"b":2,"c":3};
"a" in t; //true
"d" in t; //false