The difference between null and undefined is a little subtle. The null keyword represents "no value," meaning "nothing," not even an empty string or zero. It is a type of JavaScript object (see Chapter 8, "Objects"). It can be used to initialize a variable so that it does not produce errors or to clear the value of a variable, so that there is no longer any data associated with that variable, and the memory used by it is freed. When a variable is assigned null, it does not contain any valid data type.
A variable that has been declared, but given no initial value, contains the value undefined and will produce a runtime error if you try to use it. (If you declare the variable and assign null to it, null will act as a placeholder and you will not get an error.) The word undefined is not a keyword in JavaScript. If compared with the == equality operators, null and undefined are equal, but if compared with the identity operator, they are not identical.
from
here basically I do not check variables that way, I normally do it
if(theVar)
or
if(theVar.length > 0)
Other people tend to do it if(theVar == "") but that can lead to problems.
Eric