(function() {})() and its jQuery-specific cousin (function($) {})(jQuery) pop up all the time in Javascript code.
(function() {})()
(function($) {})(jQuery)
How do these constructs work, and what problems do they solve?
Examples appreciated