Re:Ask HN: Am I one of the few JavaScript programmers who di...
by workhere-io on Sunday April 06, 2014 @01:56AM
(#7539965)
Same thing with Python and PHP.
[ Parent
| on HN ]
Re:Ask HN: Am I one of the few JavaScript programmers who di...
by lugg on Monday April 07, 2014 @03:30AM
(#7545090)
Am I the only one who doesn't see a huge problem with this? Its actually kinda handy sometimes to have the last value / index of your array defined outside after the loop. Same goes for variables defined within the loop.
Aside from that: Function scope makes sense to me but I dont think I've ever gone and thought "damn it all, if only I had block scope!"
Re:Ask HN: Am I one of the few JavaScript programmers who di...
by workhere-io on Monday April 07, 2014 @08:41AM
(#7546110)
Am I the only one who doesn't see a huge problem with this?
I don't think anyone really sees a problem with it, although it might be somewhat of a gotcha for people coming from languages where variables are local to the loop.
Re:Ask HN: Am I one of the few JavaScript programmers who di...
by lugg on Monday April 07, 2014 @06:43PM
(#7550141)
And it doing the opposite would be a gotcha for anyone else. Is anyone able to explain why a language would have block scoping in the first place? Is it a good thing and I just don't know? I really hope its not because of the braces.. That would be kind of silly.
As it is, without that explanation, all I can think is, so weird language x does something weird and then its a gotcha when a language (funnily enough javascript) does it in a non weird way? I'd say sounds more like a gotcha for language x, than anything else.