JavaScript Verifique para indefinido
if (typeof myVariable === 'undefined'){
//myVariable is undefined
}
Grepper
if (typeof myVariable === 'undefined'){
//myVariable is undefined
}
if(typeof comment === 'undefined') {
alert('Variable "comment" is undefined.');
} else if(comment === null){
alert('Variable "comment" is null.');
}
let id;
if(typeof id === 'undefined') {
console.log("id is undefined...");
}
if (t === undefined) {
return 'Undefined value!';
}
if (typeof myVariable === 'undefined'){
//myVariable is undefined
}
if (angular.isDefined(var){
//myVariable is undefined
}