views:

293

answers:

1

Can someone explain me the syntax below line 1? I am OK with js and function references, but this code looks a bit confusing. E.g. is it function declaration and execution?

jQuery.noConflict();
(function($) { 
  $(function() {
    // more code using $ as alias to jQuery
  });
})(jQuery);
// other code using $ as an alias to the other library
+2  A: 

Exactly.
You create an anonymous function which takes one parameter, and immediately invoke it with the parameter jQuery.

Kobi
Thanks for clarification. For some reason declaration and execution in my mind counln't co-exist.
PHP thinker