xxxxxxxxxx
let myVar;
if (myVar === undefined){}
//!! Note: myVar == undefined would also check wether myVar is null
//alternatively
if (typeof myVar === 'undefined'){ }
xxxxxxxxxx
if (typeof variable === "undefined"){
//Variable is not defined
console.log("Variable \"variable\" is not defined");
}
xxxxxxxxxx
if(typeof comment === 'undefined') {
alert('Variable "comment" is undefined.');
} else if(comment === null){
alert('Variable "comment" is null.');
}
xxxxxxxxxx
let id;
if(typeof id === 'undefined') {
console.log("id is undefined...");
}