4 ms·
I like `let`. It means you have to be implicit and actually be aware of what you're doing.
by robinduckett 12y ago
I like `let`. It means you have to be implicit and actually be aware of what you're doing.
- ajanuary 12y agoThat part of the article isn't particularly clear. The intended behavior of let is great. The unintended behavior - that it can cause typeof to fail - is bad.
- taf2 12y agoIt seems to me typeof in the described case should return undefined.
- ajanuary 12y agotypeof is never being invoked, so it can't return anything. The rules of let are that any reference to the variable before the let declaration (the "temporal dead zone"), it's a reference error. So the reference error is being thrown before typeof is invoked.