JS:如何检查一个variables是不是未定义的
我试过的东西似乎并不奏效:
if(lastName != "undefined") if(lastName != undefined) if(undefined != lastName)
var lastname = "Hi"; if(typeof lastname !== "undefined") { alert("Hi. Variable is defined."); }
我试过的东西似乎并不奏效:
if(lastName != "undefined") if(lastName != undefined) if(undefined != lastName)
var lastname = "Hi"; if(typeof lastname !== "undefined") { alert("Hi. Variable is defined."); }