if (typeof variable === 'undefined') { // variable is undefined // eg: // var variable = "someValue"; }