typeof vs ==
It sounds strange but most of the web developers still use == operator to check the ‘undefined’ value of a JavaScript variable. Don’t know why but however there’s typeof operator and I strongly recommend it for that purpose.
It simply should be:
typeof variable == ‘undefined’
Why not just use the variable. For example,
if( variable ) {
alert( “The value is defined” );
}