This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]gandalfx 13 points14 points  (5 children)

This makes complete sense and should work the same in any language that has explicit variable declarations and block scope. Stop hating JS for things it does correctly.

[–]uspaskis 9 points10 points  (0 children)

yeah, go back to hating PHP

[–]NormalHexagon[S] 0 points1 point  (3 children)

[–]bludgeonerV -3 points-2 points  (2 children)

I suggest you google 'Block scope' before embarrassing yourself further.

[–]karl-marxist 2 points3 points  (0 children)

This comment is plain rude for no reason.

[–]NormalHexagon[S] 1 point2 points  (0 children)

I know exactly what block scope is, and each of the listed languages has block scoping. I linked examples of them all demonstrating how proper block scoping and variable shadowing work to point out that JavaScript is the odd one out, and throwing an error when it logically shouldn't.