JavaScript Closures

Understanding Closures in JavaScript is very important. Its one of those silent areas of JavaScript that can make your code “mis-behave” but its very powerful when you understand and take advantage of it.

Of all the materials that I’ve come across while learning it, this was the easiest to understand.


JavaScript, JavaScript...

In JavaScript, a closure is a function to which the variables of the surrounding context are bound by reference.

Every JavaScript function forms a closure on creation. In a moment I’ll explain why and walk through the process by which closures are created. Then I’ll address some common misconceptions and finish with some practical applications. But first a brief word from our sponsors: JavaScript closures are brought to you by lexical scope and the VariableEnvironment

View original post 1,042 more words


About Ody

Web Developer/Programmer and Hardcore Gamer. Mainly interested in the Web and Web Technologies

Leave a Comment

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s