What's so useful about closures (in JS)?
- by Mark Bubel
In my quest to understand closures in the context of JS, I find myself asking why do you even need to use closures? What's so great about having an inner function be able to access the parent function's variables even after the parent function returns? I'm not even sure I asked that question correctly because I don't understand how to use them.
Can someone give a real world example in JS where a closure is more beneficial vs. the alternative, whatever that may be?