5 ms·
I'm not too sure either. In JS, block scoping does not exist. There are only function scopes, so the var declaration gets hoisted out of the if block (but the a
by brianchu 13y ago
I'm not too sure either. In JS, block scoping does not exist. There are only function scopes, so the var declaration gets hoisted out of the if block (but the assignment occurs in the if block - so the assignment doesn't happen).
- chewxy 13y agoOh you can definitely fake block scoping in JavaScript, with ES5. ;P