我尝试过的一些事情似乎并不奏效:
if(lastName != "undefined")
if(lastName != undefined)
if(undefined != lastName)
我尝试过的一些事情似乎并不奏效:
if(lastName != "undefined")
if(lastName != undefined)
if(undefined != lastName)
当前回答
var lastname = "Hi";
if(typeof lastname !== "undefined")
{
alert("Hi. Variable is defined.");
}
其他回答
var lastname = "Hi";
if(typeof lastname !== "undefined")
{
alert("Hi. Variable is defined.");
}