More information about the Underscore mailing list

[_] jQuery losing the scope!

Sam Dwyer underscore404 at
Wed Dec 9 13:44:03 GMT 2009

Hi JP,
Apparently you've fixed the issue you were talking about, but I took a quick look at your code
and I noticed you mention below that you set the vid_bg_img var to be global - just so you're
aware, all your variables aside from base are global as none of them are prepended by var.

Assigning variables without the var keyword automatically attaches that variable to the window
object, giving them global scope (you can test this if you console.log(window); in firebug). 

Just thought you might be interested.

> I've set the var to have global scope line 4
> You can see the code that I've written here :
> I'm sure that this is due to a the scope of the flag variable, but I
> think I've reached the point of seeing only trees and no wood!

Add your Gmail and Yahoo! Mail email accounts into Hotmail - it's easy