0
Q:

javascript is not null

if(data !== null && data !== '') {
   // do something
}
2
//Even if the value is 0, this will execute. 

if (myVar !== null) {...}

//If you don't want it to execute when it's 0, then set it as

if (myVar) {...}

//This will return false if var value is 0.
5
var myVar=null;

if(myVar === null){
    //I am null;
}

if (typeof myVar === 'undefined'){
    //myVar is undefined
}
2
if (variable !== null) {
  console.log("Var is NOT null");
}
1
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
}
4
if (Var === null) { 
//code goes here
}
4

New to Communities?

Join the community