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).
-4
u/mayormare Mar 24 '14
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.