What is the purpose of a self executing function in javascript?

Posted by Ej on Stack Overflow See other posts from Stack Overflow or by Ej
Published on 2009-02-26T20:53:52Z Indexed on 2010/05/19 15:30 UTC
Read the original article Hit count: 132

Filed under:

In javascript, when would you want to use this:

(function(){
    //Bunch of code...
})();

over this:

//Bunch of code...

© Stack Overflow or respective owner

Related posts about JavaScript