With every fancy framework and even fancier plugin to it, JavaScript is getting easier to use - more things happening behing the scenes, less difficult algorithms and procedures to write by hand. However, every now and then in the troublefree world of frameworks and libraries one might encounter an unexpected problem and then the JavaScript rules will creep out of the shadows and there will be no other other option but to finally face them.
In this entry, I'll go back to JavaScript basics to explain one of the fundamental concepts - a closure. I'll start with explaining the documention on very simple examples and then I'll move on to two more practical use cases.
Let's start talking about the closure from looking at the definition from documentation: