If I have an undeclared variable and use typeof
it tells me it's undefined
.
But if I then check it using if (qweasdasd === undefined)
it throws an exception.
I don't understand this behavior, because if the first tells undefined
, then the second check should evaluate to if (undefined === undefined)
, why does it throw a ReferenceError exception?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…