What this mean in javascript? -


possible duplicate:
explain javascript's encapsulated anonymous function syntax

i have read javascript book have seen code:

1(function() {            // code  })(); 

what ? special function ?

as written, has syntax error.

i'm guessing more like:

(function() {           // code })(); 

or

(function() {           // code     } )(); 

break down:

(foo)() // calls foo no arguments. 

and

function() { //creates function takes no arguments.       // code } 

hence create function takes no arguments, , call it. can't see why apart showing can.


Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -