Javascript : undefined
if undefined or null
var firstName;
var lastName = null;
if(firstName == null){
alert('Variable "firstName" is undefined.');
}
if(lastName == null){
alert('Variable "lastName" is null.');
}
if null
var rob = document.getElementById('rob');
if(typeof rob === 'undefined') {
alert('This will NOT show. typeof a non existing DOM element is null');
}
if(rob === null){
alert('This will show.');
}