js判断undefined和null

js判断undefined

var exp = undefined;
if (typeof(exp) == "undefined")
{
    alert("undefined");
}

js判断null


var exp = null; 
if (!exp && typeof(exp)!=”undefined” && exp!=0) 
{ 
alert(“is null”); 
} 

js判断null和undefined


var exp = undefined;
if (typeof(exp) == undefined)
{
    alert("undefined");
}
posted @ 2019-07-03 14:02  经典鸡翅  阅读(12609)  评论(0编辑  收藏  举报