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

1 Answer 1

2

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

Sign up to request clarification or add additional context in comments.

1 Comment

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.