If we declare a variable without an initial value, the value will be undefined
:
var foo;
foo;
// → undefined
But, is there a case (e.g. some old browser, or maybe a special environment) where when declaring a variable, this variable could have a value different than undefined
?
I am just thinking why in some cases we use void 0
instead of undefined to check against undefined
?
// Why this...
if (foo === void 0) {
// ...
}
// and not this?
var U;
if (foo === U) {
...
}