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
if ('bob' in window) console.log(bob);
Keep in mind with this way, even if you declared a variable with var, that would mean it exists.
var