JavaScript Closures

Ody:

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.

Enjoy…

Originally posted on JavaScript, JavaScript...:

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

1

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 1,517 more words

About these ads

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:

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s