More information about the Underscore mailing list

[_] jQuery losing the scope!

Tim Beadle tim.beadle at
Fri Dec 11 14:33:32 GMT 2009

2009/12/9 Alex Francis <alex.francis at>:
> Just to be crystal clear - this statement in your original snippet at line 4
>    var vid_bg_img = null;
> is NOT declaring a global variable. It's inside a function
> declaration, so the variable is scoped to that function. Since you're
> also declaring some other functions within this function, they will
> also be able to see your variable, but it's not global. Might be worth
> reading about closures in javascript e.g.

Here's a couple more good articles on scope:

Also, running your scripts through (and learning to code
within its strictures) is A Good Thing.