Transport Original Address: https://zhidao.baidu.com/question/473318430.html
$ (function () {} is actually an anonymous function. This is the syntax of jquery, $ represents a jquery object, and can be used in several ways. such as passing the selector string, page objects, and so on, if the direct transfer function in the body, indicating that when the page is finished loading, execute this function.
Here is actually the anonymous function "$ (function () {}") this defines an anonymous function, which is called Arg and the function is written with parentheses and arguments, and because of the precedence of the operator, the function itself needs to be enclosed in parentheses, namely: "$ (function () {}") This is equivalent to defining an anonymous function with a parameter of ARG, and calling this anonymous function as a parameter and "$ (function () {}" is the same, the reason is to use $ only in the formal parameter, in order not to conflict with other libraries, Param.
(Funtion () {}) (); Execute the function immediately; it is equivalent to declaring a function and calling it directly after the declaration is finished.
jquery anonymous function $ (function () {}