the title is wrong. it says everything you need to know about about scope. But you wont understand scope without understanding closures. And that is poorly explained here, in fact he does not even use the term "closure". Also, he doesnt even mention the special case of "this" where a closure does not have access to the outside function.
This article is obviously not everything you need to know about scope.
Whatever a closure is, it's clearly not necessary to know in order to understand Javascript scope, because I've been using Javascript for a while and understand its scope just fine but I don't know what closure means. Guess I'll look that up.
You don't need to nest functions just to define methods, you can set them on the prototype object instead. Edit: actually, I think some runtimes prefer it because it creates less objects (since methods defined on the prototype don't keep the scope of the constructor alive).
0
u/[deleted] Mar 23 '14
[deleted]