Quote:
Originally Posted by johnmerlino
So if scope chaining is built into javascript (variable checks parent scope if not defined in current scope), then what's the added benefit of closures? Someone said that the benefit of closures is when interpreter exits parent function (e.g. Validation()), you can call the inner function later (e.g. $.Validation.getRule()) and gain access to the variables of the parent. Yet, in scope chaining, that happens anyway! So I absolutely see no benefit in closures.
|
I don't know if your talkin to me ?
But just look at the code i posted
for the very simple count down timer,
thats all about closures.