JS, если не неопределен
if (typeof myVar !== "undefined") {
console.log("myVar is DEFINED");
}
Grepper
if (typeof myVar !== "undefined") {
console.log("myVar is DEFINED");
}
if(typeof comment === 'undefined') {
alert('Variable "comment" is undefined.');
} else if(comment === null){
alert('Variable "comment" is null.');
}