Sunday, December 2, 2012

Disclosing the Javascript CLOSURE

This is my third post in the series - "Perplexed world of javascript" . It is very important and subtle concept , hence i will try to explain in a very intuitive way.

So i guess most of you must have been in relationship.Now what is the difference between "Breakup" and "Moving On"?

"Beakup" is an event and it is very visible and evident but not the "Moving On" , it is a very subtle in nature and it depends on people how many months , years or even decade ,it will take to completely "Move On".Now programming languages also behave in similar manner.

Lets try to figure out the output of the following code snippet.

//Code Snippet




3 comments:

  1. This type of programming makes javascript confusing for many developers. But there is real pleasure in cracking this code. Good one dude.

    ReplyDelete
  2. m a beginner in this language and want to ask a very basic question...
    How to run the snippets and see the O/P? :P

    ReplyDelete
    Replies
    1. 1. Open a text editor.
      2. Write code as i have shown in the image above in the post.
      3. Put your javascript at the place marked as "//Paste any javascript code here//".
      4. Save the file with the extension ".html" e.g Test.html.
      5.OPen in your favorite browser.
      6. Voila :) you just executed your first javascript.

      Delete