What is the benefit of wrapping a jquery function in a closure?
<p>Hi I've been busy trying to take my knowledge of JQuery to the next level, So far I think I've understood everything but as I've ventured onto more advanced tutorials I've noticed several instances where the JQuery routine is wrapped in a closure (see below) however, the thing that confuses me is that it passes a $ and returns JQuery. My question is why? what can I do with the returned JQuery?</p>

<p>I'd really appreciate any light that people can shed on this for me.</p>

<pre><code>(function($){
  $(document).ready(function(){
    var arr = $.map($("LI"), function(item, index){
      while (index &lt; 3)
      {
        return $(item).html();
      }
      return null;
    });
    $(document.body).append("&lt;span&gt;The first three authors are: " +
      arr.join(", ") + "&lt;/span&gt;");
  });
})(jQuery);
</code></pre>

<p>Thank you in advance.</p>

<p>Rob</p>
