;! function () {} (); ;! What's the use?
Go from grammar to open. The semicolon in JavaScript indicates the end of the statement, plus at the beginning. It may be for compression and other methods to cut, indicating a new statement starts. So, let's say it's in a separate JS file. The beginning of the semicolon is no matter what the meaning, can be deleted.
An exclamation point is a logical operator, which is "non", and is commonly written if (!true) {}. Instead of loading the operator in front of the function definition, the function is considered to be a population. Then call this function again. And a logical operation of the returned structure.
Plainly, here is the construction of a running function immediately, it is recommended that the landlord know the meaning can be. When you write, you can use a clearer format:
(function () {}) ();
Add a point here: Add "()" after the function Declaration "functions () {}", meaning to run the function declaration.
Some are called "anonymous self-running functions", more accurately said should be "run function immediately".
But run the function immediately, as part of the expression, or the JS interpreter will report a syntax error. So so. The easiest way to understand an expression is to add a parenthesis to the left and right ends, like this "(function () {})". So, the most common notation for running functions right away is "(function () {})", which is a statement that can be added "in front and behind"; 】。
In fact, running the function immediately also has n notation, such as "(function () {})". Adding a unary operator before a function declaration is also OK: "!function () {} ()", "~function () {} ()".
Even. The combination of unary operators can also: "!!!! function () {} () "," ~~~function () {} () ","!~!function () {} () ").
JS with the meaning of semicolons and exclamation marks