(function($){})(jQuery);
It’s actually relatively simple, you need to understand a few concepts:
1. (), in JavaScript () means executing a method, such as:
function x(){
alert("xxx");
}
var a = x; // No call, a is a function
var a = x(); //The function is called, and the value of a is the result of the call: undefined
2. jQuery is a jQuery object, which means that when calling a function, a parameter passed in is a jQuery object.
There’s nothing to say about this
3. (function($){}) This is an anonymous function, the formal parameter is $, and parentheses are definitely required.
You can understand it at a glance. The above formula is equivalent to
var f = function($){};
f(jQuery);
Look at it now, it’s neither simple nor weird...