How do I determine if variable is undefined or null?
undefined
null
My code is as follows:
var EmpN
var x; if (x === undefined) { alert ("only declared, but not defined.") }; if (typeof y === "undefined") { alert ("not even declared.") };
You can only use second one: as it will check for both definition and declaration