By eliminating all the unnecessary elements, like white spaces, comments, new line characters, etc., it helps in minimizing the size of the source code by up to 80%.
- Copy the JS Code that you want to compress.
- Paste the code in the box given in http://www.jsminification.com/
- Press “Compress Now” Button, and get the compressed code. This tool is exceptionally fast, and delivers the compressed code within a few seconds.
Benefits of JS Compression Tool
The JS Compression Tools offer an array of benefits including:
- It enhances the loading speed of the website and delivers faster loading websites capable of getting loaded even with the smaller bandwidths.
- Apart from removing unnecessary elements, the variable names are shortened, and are usually replaced by single characters, the JS compression tools deliver extraordinary compression.
- The “If” statements are optimized, simple constant expressions are calculated, and the arrays are converted into objects wherever possible to achieve unmatched compression.
- The compression is done very intelligently, so that the functionality of the source code does not get compromised. Moreover, it helps in improving the performance of a website significantly.
With all these benefits, JS minification is something, you must do with your JS code to optimize your website.
Originally published at blog.dailyutils.com.