I'm a bit confused about how best to check if a variable is undefined or not in javascript. I've been doing it like this:
myVar === undefined;
But is it better in all cases to use typeof instead?
typeof myVar === undefined;
And what about the use of undefined
vs "undefined"
, which I've also seen?