Mostly you can use this simple statement: if (myVariable) {
//do something
} It will check for: false , boolean. an empty string , ‘’ undefined , if the variable was not defined and its value is “ undefined ”. null , if its null . 0 , number zero.  NaN , not a number. This statement covers all cases and its the correct and easiest way to check if an variable exists or holds one of the listed values.  You could also use the explicit check for “ undefi