if (typeof myVar !== "undefined") {
console.log("myVar is DEFINED");
}
if ( typeof query !== 'undefined' && query )
{
//do stuff if query is defined and not null
}
else
{
}
if(typeof my_var === 'undefined') {
//my_var is undefined
}
let foo = undefined
//will return true
typeof foo === 'undefined'