xxxxxxxxxx
if (variable === null) { //Executes only if variable is null but not undefined
//Code here
}
if (variable == null) { //Executes if variable is null OR undefined
//Code here
}
xxxxxxxxxx
var myVar=null;
if(myVar === null){
//I am null;
}
if (typeof myVar === 'undefined'){
//myVar is undefined
}
xxxxxxxxxx
let myStr = null;
if (myStr === null) {
console.log("This is a null string!");
}
/*
This will return:
"This is a null string!"
*/
xxxxxxxxxx
if(!pass || !cpass || !email || !cemail || !user) {
// Code here
}
// Which will check for empty strings (""), null, undefined, false and the numbers 0 and NaN