I am not asking if the variable is undefined or if it is null. I want to check if the variable exists or not. Is this possible?
null
try this
var ex=false; try {(ex=myvar)||(ex=true)}catch(e) {} alert(ex);
where ex is true if myvar has been declared.
ex
myvar
working example: http://jsfiddle.net/wcqLz/