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?
I'd really appreciate any light that people can shed on this for me.
(function($){
  $(document).ready(function(){
    var arr = $.map($("LI"), function(item, index){
      while (index < 3)
      {
        return $(item).html();
      }
      return null;
    });
    $(document.body).append("<span>The first three authors are: " +
      arr.join(", ") + "</span>");
  });
})(jQuery);
Thank you in advance.
Rob
 
     
     
    