Is it necessary to add a semicolon to the beginning of a function in JS? Should I add a semicolon after the JS statement? Should a semicolon be used after JavaScript braces? JS function in the beginning of the exclamation point, semicolon what does it mean?
JS multiple files integrated into a file, compressed code to avoid syntax errors, you can deal with the following
One, JS Front plus semicolon
For example:;(function ($) {... Here's the code ...}) ();
In JavaScript, a semicolon denotes the end of a statement, which, at the beginning, is separated from other methods for compression, indicating that a new statement begins
Second, JS function plus semicolon
For example
Module 1
//preceded by a number
of code var Manager = {
prop: ',
method:function () {
}
}
//Module 2, beginning with an immediate execution function
(function () {
//Code
}) ()
After compression becomes:} (function there, it will be executed as a functions, so the whole parsing will be wrong
Copy Code code as follows:
var Manager = {prop: ', Method:function () {}} (function () {}) ()
Workaround: Add a semicolon after the manager function
The above mentioned is the entire content of this article, I hope you can enjoy.