1if( typeof myVar === 'undefined' || myVar === null ){
2 // myVar is undefined or null
3}
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
1var myVar=null;
2
3if(myVar === null){
4 //I am null;
5}
6
7if (typeof myVar === 'undefined'){
8 //myVar is undefined
9}