JavaScript memeriksa tidak ditentukan
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.');
}
Your question goes here...What is undefined
The undefined property indicates that a variable has not been assigned a value,
or not declared at all.
let name;
console.log(name); // undefined