Possible Duplicate:
How does this JavaScript/JQuery Syntax work: (function( window, undefined ) { })(window)?
I am trying to breakdown some of the parts of jQuery to better understand what's going on behind the scenes. For the most part, I am pretty clear on a lot of it's methods, but the first line of code looks like this:
(function( window, undefined ) {
and the library ends like this
})( window );
I understand that this is immediate function invocation, but what does this do in context to the jQuery library? I'm not sure what I am looking at.
Also, where else would this be useful to us?