Format:
Explanation: This is quite elegant code (if you first see a possible confused:), the first pair of parentheses of the enclosing function (function () {}) returns an unnamed function to the script, followed by a pair of empty parentheses that immediately executes the returned unnamed function, with the parameters of the anonymous function in parentheses.
Here's an example with a parameter:
(function (ARG) {
alert (arg+100);
}) (a);
This example returns 120.
Come back and look at jquery plugin writing
(function ($) {
//Code goes Here
}) (JQuery);
This code is equivalent to
var A=functon ($)
{//code
};
A (jQuery);
The above in-depth understanding of JavaScript in the implementation of the anonymous function is a small series to share all the content, hope to give you a reference, but also hope that we support the cloud habitat community.