… or, Prefer this scope to closure scope, Prefer stub scope to this scope
JavaScript is a very flexible language like Perl, and so gives you many ways to carry out the same task. Take something simple like writing a function that returns an object. How many ways can you think of to do that?
If you’ve heard of the Module Pattern, you might think that this is a well-settled question. But the Module Pattern gives you lots of leeway in implementation. In this post I’ll take away most of that wriggle room.