标签: javascript jquery undefined
我尝试过的东西似乎不起作用:
if(lastName != "undefined") if(lastName != undefined) if(undefined != lastName)
答案 0 :(得分:287)
var lastname = "Hi"; if(typeof lastname !== "undefined") { alert("Hi. Variable is defined."); }