javascript check if not undefined

JavaScript
if (typeof myVar !== "undefined") {
    console.log("myVar is DEFINED");
}if (typeof myVariable === 'undefined'){
    //myVariable is undefined
}if(typeof x !== 'undefined'){
  alert("Variable x is defined.");
}if ( typeof query !== 'undefined' && query )
{
  //do stuff if query is defined and not null
}
else
{

}
if (query){
   doStuff();
}
Source

Also in JavaScript: