I like the concept of closure, even though most of us think that it is complex topic. I would not go to the detail side of the closure but I would like to let you know by using an example. I was using closure unknowingly from past 4 years. Lets cut the chase and come to the point.


Dont you observe, I have called the function foo() once, but it is maintaining the value of a.

So, simple definition says that, when you define any function inside a function, you are using closure, And closure function keeps the copy of all the local variable passed to them.

Thats It. Ya, Thats It.


Leave a Reply

Your email address will not be published. Required fields are marked *