I can’t stand writing Javascript with semicolons.
How to fix Javascript… maybe
Drew Hamlett
13413

It is very important to put semicolons in JavaScript.

Unlike Python, where indentations clearly mark the end of a line or expression, the engines running JavaScript will try to place the semicolons for you which can lead to unexpected and hard to debug errors in some minor cases. Most of these can be avoided though by correctly using curly braces and parenthesis.

But most importantly, it is very confusing to the engine in case of functions. You can accidentally invoke them (take a look at IIFE) or pass them as arguments to other functions. If you look at libraries that are wrapped into an IIFE, you can usually see a semicolon at the beginning of the code.

These kinds of errors are the hardest to debug since the problem is not in your logic but your coding style. We can argue that it is a silly mistake in the language and maybe it is, but it can easily be avoided by pressing ; when our expressions end.

So why can’t we just use new lines like in Python? Because of code minification. We want to be able to run code where everything is in one line because it is smaller and downloads faster. It does not seem like much in single files but it adds up and removing whitespace and new lines can make a lot of difference in huge projects.