How dangerous is it in JavaScript, really, to assume undefined is not overwritten?
问题 Every time anyone mentions testing against undefined , it's pointed out that undefined is not a keyword so it could be set to "hello", so you should use typeof x == "undefined" instead. This seems ridiculous to me. Nobody would ever do that, and if they did it would be reason enough to never use any code they wrote... right? I found one example of someone who accidentally set undefined to null , and this was given as a reason to avoid assuming that undefined isn't overwritten. But if they'd