var a = 'defined'
if(typeof a == 'undefined') {
alert('it is undefined');
}
Testing if Something is Undefined in Javascript
Oct 14th, 2007
Had a question come up from a colleague that used to cause problems when I first started using JavaScript. How to test whether a variable is undefined:
Posted In: JavaScript