Mailing List Archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [tlug] Variable scope in Javascript driving me nuts



> When you reference a variable called "valid" in checkResult it first
> checks the functions local variables it finds none. So it goes up to the
> closure scope and finds "valid" there. If it didn't find it there it
> would look in the global scope. And if it didn't find it there it would
> create a new local (though you might get a warning about not using the
> "var" keyword).

That last sentence was wrong, sorry! If it didn't find it then it would
create it as a global, not a local.

Darren


-- 
Darren Cook, Software Researcher/Developer

http://dcook.org/gobet/  (Shodan Go Bet - who will win?)
http://dcook.org/work/ (About me and my work)
http://dcook.org/blogs.html (My blogs and articles)


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links