How to check if a JavaScript variable is NOT undefined?
javascript, undefined
Solution
var lastname = "Hi";
if(typeof lastname !== "undefined")
{
alert("Hi. Variable is defined.");
}
Problem
Things I’ve tried that don’t seem to work: ``` if(lastName != "undefined") ``` ``` if(lastName != undefined) ``` ``` if(undefined != lastName) ```