
The Answer to this question is simple, But before We know the answer we should know, What JavaScript Minification is?
JS Minification is a very important thing to know, Especially with Big Projects, But
What is JavaScript Minification?
let’s say we have a function called HelloPlanet 😛
function HelloPlanet(planet){
if (planet == "Pluto"){
console.log("Pluto is not a planet")
} else {
console.log("Nice to meet you, You are from Planet " + planet)
}
}
HelloPlanet("Pluto");
In this function the output is
Pluto is not a planet
Now after Minifing with [https://javascript-minifier.com] or any other similar website:
function HelloPlanet(o){"Pluto"==o?console.log("Pluto is not a planet"):console.log("Nice to meet you, You are from Planet"+o)}HelloPlanet("Pluto");
And In this function the output is
Pluto is not a planet

See the difference, Right? It removed all unnecessary spaces and line breaks,
Imagine Minifing a very big JavaScript file. It would make a big difference in size.
Ever heard of JQuery?
JQuery is a well-known JavaScript Library, Often used to make JS Development Allot Easier, But what did They do with the size problem, They Minified it of course.
Let’s compare The Minified Version With The Normal Version:

In English Please
jquery-3.6.0.js (Normal Unminified) –Size–> 282K –Exactly–> 288580 Bytes
jquery-3.6.0.min.js (Minified) –Size–> 88K –Exactly–> 89501 Bytes
288580 Bytes – 89501 Bytes = 199079 Bytes ~= About 200K In Size
That would make a big difference.
But can We revert it back to normal?
Of Course, you can (Every Thing Is Possible) with sites like [http://jsnice.org]
Bonus 😀 : JavaScript Obfuscation
If you are trying to make your JavaScript Code “More” Unreadable Consider JS Obfuscation With [https://www.obfuscator.io]
I Have An Article About it HERE
// TODO: Write An Article About It ASAP //
And As Someone Great Once Said:
Stay Tuned
Me
~ViloDium