Site Loader

Understanding the JavaScript Closures

What is a closure?

A closure is an inner function that has access to the outer/enclosing function’s variables scope chain.
Closure has three scope chains i.e.,
1) It has access to its own scope (variables defined between its curly brackets)
2) It has access to the outer function’s variables, and
3) It has access to the global variables.

The inner function has access not only to the outer function’s variables, but also to the outer function’s parameters.

Note that the inner function cannot call the outer function’s arguments object; however, even though it can call the outer function’s param’s directly.

In simpler way to say what is closure? If you create a function inside / within another function its called as closure / private function.

Understanding the JavaScript Closures

An Example of Closures in JavaScript:


Will come up with next article on this with more details of closures and some more example’s & Closures’ Rules and Side Effects, usage and so on….
You can find more even in W3C about closures:



I am a UI Designer with a passion for designing clean and simple user interfaces.
I do smart UI design, My career path is simple "Challenges are always interesting as they keep me moving, but learning from them and implementing is my motto"
Understanding good UI design can help you create the more user friendly portals.


I am a User Interface Developer with experience in coding XHTML, HTML, HTML5, CSS, CSS3, Bootstrap UI Framework, SEO, jQuery, JavaScript, PHP and MySQL.
I focus on writing clean and efficient code.

Leave a Reply

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

Time limit is exhausted. Please reload CAPTCHA.