1if (variable === null) { //Executes only if variable is null but not undefined
2 //Code here
3}
4
5if (variable == null) { //Executes if variable is null OR undefined
6 //Code here
7}
1var myVar=null;
2
3if(myVar === null){
4 //I am null;
5}
6
7if (typeof myVar === 'undefined'){
8 //myVar is undefined
9}
10
1if(!pass || !cpass || !email || !cemail || !user) {
2 // Code here
3}
4// Which will check for empty strings (""), null, undefined, false and the numbers 0 and NaN