Should you use semicolons in JavaScript?

Published:

I promised I’d start making videos last week, didn’t I? Well, here’s the first video! Today, I’d like to talk about semicolons.

There are people out there that say you’re not a real developer if you don’t use semi-colons in JavaScript. Is that really true? Should you listen to them and use semi-colons?

That’s what I dive into in this video. I also show a very important tool to help you write good, consistent code in the video.

A transcript

It doesn’t matter whether you use semi-colons or not in your JavaScript. It is not going to make a big difference in the quality of your code.

If you don’t use semi-colons, your code might look abit nicer without the dangling dots at the end of each line, but that’s about it.

I understand there that are people who would say that if you don’t use semi-colons, your code is shit. Don’t listen to them and don’t worry about them, because they’re too rigid in their thinking, and they cannot accept new things.

It’s okay to use or not use semicolons. It boils down your preference or your team’s preference.

Personally, I don’t use any semi-colons in my code because it feels nicer to write JavaScript without it. I used to use semicolons before, and I tried removing it, and I realize its okay.

If you want to find out about why you can omit semicolons, read Feross’s article.

Use a linter to help write consistent code. If you use Sublime Text, I suggest Sublime linter.

If you use other text editors, search for “your text editor” plus “linter” and you should be able to find a good one.

If you want to omit semicolons, I suggest you use standard (https://standardjs.com). If you like semicolons, you can try semistandard (https://github.com/Flet/semistandard).

If you have any questions about frontend development, or if you want to say hi, feel free to send me an email.

Here's how to become great at JavaScript in less than 2 months

If you’re stuck because of your lack of JavaScript skills, you can stop worrying now.

We’ll help you become amazing at JavaScript — we have a course that can help you understand and use JavaScript easily.

And we’re going to give you three chapters for free because we love to help developers become superheroes.

Just click the button below to become an amazing JavaScript developer.