JavaScript is a scripting language that was developed by Netscape in order to design interactive websites. Though it shares most of the features of Java language but was developed independently. HTML source code interaction is extensively practiced in JavaScript to spice up the sites with dynamic content. A number of companies endorse JavaScript as it is an open source and you need not to purchase it.
Minification is the removal of unwanted characters from the code to reduce the size thereby enhancing load time. While minifying, invalid comments and white spaces get removed. In case of JavaScript, this further improves response time and performance.
While optimization the site following techniques come into play:
Request reducing techniques
This technique reduces the number of requests by merging multiple JavaScript files into lesser ones. Reduction of the request is effective in site optimization immaterial of the file size. Every request takes around 20ms up to 100ms or even more. Though, that isn’t too long but the majority of the websites are made up of a number of images, style sheets, etc. Various tools are available that help concatenate JavaScript files automatically, but you can’t simply concatenate all the files and expect it to be an efficient result.
Content size reduction technique
This technique reduces JavaScript size by eliminating the unwanted space that are mostly present in all files created by a developer. The unwanted space helps developer organize code to structured blocks, enabling easy debug and understanding. There are certain testing methods such as Baseline web testing, site optimize testing, etc. that have an impact on JavaScript.
Purpose
The basic purpose is to increase the downloading speed and swift transfer of JavaScript code from the server hosting the website. Downloading becomes agile because it reduces the data amount that is ought to be downloaded. Lesser data obviously means the browser is taking the minimum possible processing time. Hence, the minification is carried out on JavaScript source code as it enhances performance as well as productivity.