Demystifying JavaScript Closures, Callbacks and IIFEs

A closure is not any function. This is just plain wrong. Closure have nothing to do with a function, in theory.

A function in JavaScript is an Object that inherits the function.prototype methods and arguments (apply(), call(), …)

A closure on the other hand, refers to the execution context of a callable. And here lies the small difference in meaning where a lot of geeks (like me) tend to get ‘mad’ about. Ofcourse, execution context kind of only makes sense when executing a function. And yes, it says something about ‘what do I have acces to’. But understanding the difference makes understanding the ‘this’ word so much easier. And the methods like .call() and apply() suddenly start to make real sense.