Possible Duplicate:
Detecting an undefined object property in JavaScript
Would it be like this?
if(variable == undefined) {
or would it be like this?
if(variable == "undefined") {
Possible Duplicate:
Detecting an undefined object property in JavaScript
Would it be like this?
if(variable == undefined) {
or would it be like this?
if(variable == "undefined") {
if(typeof(variable) == 'undefined')
if (typeof variable == 'undefined')
Use the typeof
operator here, like this:
if(typeof variable == "undefined") {