News for hackers. Stuff that matters.
Re:The best JavaScript guide ever by nfriedly on Wednesday October 06, 2010 @08:28PM (#1766405)
Yes, as several people have mentioned, I should have said block scope. JS does allow for blocks, but they don't work the way the parent was thinking.

You can toss extra curly braces in the code and it is a "block" but unless they are preceded by an "if", "for", or something similar, they don't do much. They do not return values and they do not affect variable scope. Functions do both, hence my last example.

Re:The best JavaScript guide ever by Tichy on Thursday October 07, 2010 @03:11AM (#1767085)
I think my understanding of blocks is fine. "Returning" was the wrong expression, I meant the value of a script (like the result of an eval). I am aware of the lack of block scope in JS :-)
Re:The best JavaScript guide ever by nfriedly on Thursday October 07, 2010 @09:40AM (#1767763)
Gotcha, glad you've got it figured out then =]