News for hackers. Stuff that matters.
Re:Hide this in your coworkers' JavaScript code tomorrow by brianchu on Monday March 31, 2014 @09:59AM (#7501471)
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).
Re:Hide this in your coworkers' JavaScript code tomorrow by chewxy on Monday March 31, 2014 @10:18AM (#7501581)
Oh you can definitely fake block scoping in JavaScript, with ES5. ;P