Remove unnecessary characters and whitespace from JavaScript code to reduce file size and improve loading times.
Help us make tools better by telling us your review about this tool
JavaScript is the programming language that is responsible for providing more interactivity and vitality for web pages.
When JavaScript is run in the browser, no compiler is needed. The browser can read the code directly, without a third party.
Therefore, it, together with HTML and CSS, is recognized as one of the three native languages of the web.
Minify, also known as minimizing, is the method of deleting all needless elements from JS source files without modifying their functionality.
This comprises the elimination of whitespaces, comments, and semicolons. The Minifying JS code results in compact file size.
The size of your JS source file will be reduced which will definitely affect the loading speed of your webpage.
Here is a little example of Minifying JS code:
Input:
// This function takes in name as a parameter
// and logs a string which greets that name
// using the information passed
function sayHi (name) {
console.log ("Hi" + name + ", nice to meet you.")
}
sayHi("Sam”);
Output:
function sayHi(name){console.log("Hi"+name+", nice to meet you.")}
sayHi("Sam”)