This article will share with you the difference between .min.js and .js files in javascript. If you have friends who don’t know the difference between the two, you can take a look at
Q: What are .js and .min.js files?
A: .js is a JavaScript source code file, and .min.js is a compressed version of the js file.
Q: Why should it be compressed into a .min.js file?
Reduce size
The .min.js file is compressed, smaller in size than the js file before compilation, and has fast transmission efficiency.
Prevent peeking and stealing the source code
After coding, the original names of variables and functions are changed to meaningless names to prevent others from peeking and stealing the js source code
Q: What are the advantages and disadvantages of .js and .min.js files?
.js文件: 优点: 可读性较好,易于debug和更改. 缺点:体积较大,传输时间长 .min.js文件: 优点:体积较小传输快, 源码防窃 缺点:可读性差
Q: How to generate .min.js file?
Use compression tools:
Google的在线版本 Javascript Closure Compiler 压缩工具参考list: [http://www.cnblogs.com/lhb25/p/15-best-javascript-minifying-tools.html][1]
Q: Compression principle?
Compression: Remove all comments, tabs, line breaks and useless spaces in the js code, thereby compressing the JS file size.
php object-oriented detailed explanation of the differences between private, protected, and public
What is the difference between @HostBinding() and @HostListener() in AngularJS
The difference between method and computed in Vue
The above is the detailed content of What is the difference between .min.js and .js files in javascript?. For more information, please follow other related articles on the PHP Chinese website!