Home >Web Front-end >JS Tutorial >js encryption compression bug solution_Basic knowledge
The method to check the error after streamlining in this situation: Open the script error prompt of IE, and then open the HTML page that calls JS. It will report the location of the missing semicolon, then use UE to open the streamlining JS file and go to the corresponding Add a semicolon to the position, then find the corresponding position in the unreduced JS code and add a semicolon.
For example:
changed to:
◆Try to use braces
in the statement after else
In this case, it is more troublesome to check the error. Use the regular expression else[a-zA-Z0-9] to find the streamlined JS file, or check whether there is a commented line after else, and then find the corresponding line in the unreduced JS code. Add braces at the position.
For example:
changed to:
◆Try to add a semicolon after the inverse brace of function
For example:
changed to:
In this way, the problem of error reporting after compression can be solved after compression.
At the same time, pay attention to the problem of garbled Chinese characters. You can use copy and paste instead of saving as a file.
window.load = function()
{
}
If defined this way, there must be a semicolon at the end.