xxxxxxxxxx
if (typeof myVariable === 'undefined'){
//myVariable is undefined
}
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...");
}
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 undefined
}