What's so useful about closures (in JS)?
Posted
by
Mark Bubel
on Programmers
See other posts from Programmers
or by Mark Bubel
Published on 2013-07-03T03:23:29Z
Indexed on
2013/07/03
5:18 UTC
Read the original article
Hit count: 160
JavaScript
|closures
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?
© Programmers or respective owner