Skip navigation

/*Anonymous function with parameter, executed immediately*/
(function(foo, bar){

Interestingly anonymous functions used to create closures. Closure is protected variable space.

Consider the following function
var foo=2;
var bar=3;
mul = function(){

You won’t get any alerts after its execution. but

will give an alert !

After anonymous function’s execution, how can function mul get executed? that too accessing its foo and bar?

Will update the post soon!!!

Leave a Reply

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

You are commenting using your 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

%d bloggers like this: