Optimization of Download size:
One: Compression tool compression
ESC-1.14
E:esc-1.14>cscript esc.wsf-l 4-ow e:jssrc.js e:jsnew.js
-L Leval level [0-4] 0 Merge multiple js, 1 go to comment 2 go to space 3 Remove line 4 simplify variable naming
The first argument after-ow is the original file, and the second parameter is the post-execution file. Multiple file spaces separated
Second: When writing code
(1) shortening the negative judgment Obj!=null =>!obj
(2) define the array var arr=new array (); => var arr=[];
(3) Define null object var Obj=new object (); => var obj={};
(4) Defining JSON-formatted objects
Optimization of operating efficiency
(1) Define variable don't forget Var, otherwise become window object
(2) Use local variables as far as possible
(3) Circulation, high performance
(4) doing while ratio while performance is high
(5) Priority to use the built-in method
(6) Storing common values
(7) Save the use of DOM. If you replace a div's table content, changing the innerHTML of the div is better than a lot of manipulating table DOM performance