I\'m trying to wrap my head around closures (there\'s a joke in there somewhere) and I ran across this:
(function () { /* do cool stuff */ })();
That creates a function, calls it, and discards it.
It might be clearer if you look at it like this:
var throwaway = function(){
// do cool stuff
};
throwaway();
This is done to create a private namespace. Code in the function can have functions and variables without worrying about conflicting with other code loaded in the page.