So, “closures”, right? That’s a fun one that tends to cause confusion all around.
It’s pretty much a given that at some point in your life you’ve been walking down the street and overheard two shady guys on a corner whisper about how mighty a concept closures are — and chances are you then went home, tried to look up those mysterious “closures”, and didn’t seem to get what all the fuss was about. After all, they are just doing what any rational being would expect to be done in some way or other anyway, right?
‘Nuff said. Here’s what’s gonna happen:
First, I will ease you into the basics, in case you time travelled here from 1974 and have no idea what I’m talking about. There will be a few examples of the stuff you already knew anyway — maybe without even suspecting that closures are involved — and a bit of narrative going on. This is the part where you can lean back and enjoy yourself.
Second, I will explain the situations in which you can greatly benefit from knowing what closures actually do, and show a few examples of closures that don’t “just happen” but are used intentionally to make your life easier.
Third, The Real Life. Not just code snippets, but full commented example pages, with both the code and a live iframe to see the code at work.