I want to check if a variable is undefined and quickly found some stackoverflow answers that said the correct way to do it is to test if(variable==null). But in Chrome I am getting an error saying: Uncaught ReferenceError: xdate is not defined
Huh? The whole reason I am testing is so I don't get errors like this. And I did it just like the approved stackoverflow answers. Here is my code snippet.
if (xdate == null){
var dateadd = "";
} else {
var dateadd = "&date="+date;
}