null, 空 ,undefined判断
总结: js中 未定义的变量,值为null,值为undefined的值相等,三者与值为空的变量不相等。 判断undefined var exp = undefined; if (typeof(exp) == "undefined") { alert("is undefined"); } 判断null var exp = null; if (!exp && typeof(exp)!=”undefined” && exp!=0) { alert(“is null”); } 来源: CSDN 作者: ann_d 链接: https://blog.csdn.net/ann_d/article/details/104671439