We help IT Professionals succeed at work.

Closures in JavaScript

milani_lucie
milani_lucie used Ask the Experts™
on
Hi,

Can you please explain to me in simple terms:

Closures in JavaScript ?

I have followed this example but i did not understand:

http://soumya.wordpress.com/category/javascript/

If you can, please explain to me line by line of the above example ?

Thanks
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2007
Commented:
A quick Google search for javascript closure returns a few detailed explanations; this is the first:

http://jibbering.com/faq/notes/closures/

>>Can you please explain to me in simple terms:

This from the above site:

"A "closure" is an expression (typically a function) that can have free variables together with an environment that binds those variables (that "closes" the expression)."

Author

Commented:
Already checked the URL.
Top Expert 2007

Commented:
No worries - glad to help.