标签:
//在js中if条件为null/undefined/0/NaN/""表达式时,统统被解释为false,此外均为true .
//为空判断函数
function isNull(arg1)
{
return !arg1 && arg1!==0 && typeof arg1!=="boolean"?true:false;
}
//alert(isNull(null)); //true
//alert(isNull(‘‘)); //true
//alert(isNull()); //true
//var aa={};
//alert(isNull(aa.a)); //true
//alert(isNull(0)); //false
//alert(isNull(‘0‘)); //false
//alert(isNull(true)); //false
//alert(isNull("undefined")); //false
//alert(isNull(undefined)); //true
//alert(isNull([])); //false
//alert(isNull({})); //false
标签:
原文地址:http://www.cnblogs.com/fearclear/p/5866336.html