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
}
if (Var === null) {
//code goes here
}
if (Var === null) {
//code goes here
}
let myStr = null;
if (myStr === null) {
console.log("This is a null string!");
}
/*
This will return:
"This is a null string!"
*/
null == null // true
null == undefined // true
null == 0 // false
const number = null;
if(!pass || !cpass || !email || !cemail || !user) {
// Code here
}
// Which will check for empty strings (""), null, undefined, false and the numbers 0 and NaN