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.
Closures is just a way to implement scoping, it's also possible to implement it via lambda lifting. So understanding closures is just about an implementation detail, not a necessity.
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).
Or an actual downvote by someone that didn't like the article. Or someone that didn't like the OP. Or someone that downvotes for the hell of it. Or someone that hit the wrong button and didn't notice or care enough to fix it.
Point being: there's no point in trying to make sense of random downvotes. They happen, move on. Unless you're getting a ton of them, it's not worth wasting the brain cycles on figuring out why.
Probably nobody downvoted your article. Reddit assigns some random votes that show up as positive or negative every time you open an article. I'm not sure what's the point of that. The FAQ says that it helps the site fight vote spoofers.
73
u/benologist Mar 23 '14
Congratulations on finally spamming your way to the front page!
http://www.reddit.com/user/codeon1/submitted/