How do JavaScript closures work?

Well, I tried to explain JavaScript closures to a 27-year-old friend and completely failed.

How would you explain it to someone with a knowledge of the concepts which make up closures (for example, functions, variables and the like), but does not understand closures themselves?

asked Aug 18, 2015 in JAVASCRIPT by rajesh
0 votes

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.