js encryption compression bug solution_Basic knowledge
May 16, 2016 pm 04:30 PMThe 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:
var a=1
var b=2
changed to:
var a=1;
var b=2;
◆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:
if (a>b)
a=b;
else
b=a;
changed to:
if (a>b)
a=b;
else
{b=a}
◆Try to add a semicolon after the inverse brace of function
For example:
function a() {
}
function b() {
}
changed to:
function a() {
};
function b() {
};
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.

Hot Article

Hot tools Tags

Hot Article

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

How to use JS and Baidu Maps to implement map pan function

Recommended: Excellent JS open source face detection and recognition project

Essential tools for stock analysis: Learn the steps to draw candle charts with PHP and JS

PHP and JS Development Tips: Master the Method of Drawing Stock Candle Charts

How to create a stock candlestick chart using PHP and JS

How to use JS and Baidu Maps to implement map polygon drawing function

How to use JS and Baidu Map to implement map click event processing function
