Things I’ve tried that don’t seem to work:
if(lastName != "undefined")
if(lastName != undefined)
if(undefined != lastName)
This question is related to
javascript
undefined
var lastname = "Hi";
if(typeof lastname !== "undefined")
{
alert("Hi. Variable is defined.");
}
Source: Stackoverflow.com