Why do people care about semicolons so much?

All I hear these days from developers is whether or not you should be adding semicolons to your code and to be honest, it’s completely up to you and it doesn’t make a difference either way.

I recently read an article by Mattias Peter Johnson called Semicolons cannot save you. It’s a really good article and deserves a read. He talks about how it doesn’t matter if you use semicolons or not just that your reason for going one way or the other is a good one. The only bad reason being the misconception of blaming the Automatic Semicolon Insertion (ASI).

The ASI isn’t the best thing in the world but it’s also not the worst and actually doesn’t make a difference in how you should use semicolons. I’ve always believed that in any programming language, be that JavaScript or Python, if semicolons have to be used anywhere you should be using them throughout. Consistency is key when reading through code. You wouldn’t like to look through someones code and they use for loops and forEach loops with no real reason for switching other than they felt like it at the time.

If you fancy using a for loop to iterate over an array of Strings then you’re going to have to use semicolons and it just doesn’t seem right to not use them in other places.

No matter if you use or don’t use semicolons then you’re going to have an opinion on them just like I do. I know people will disagree with what I’ve said here but it’s just my opinion and you’re more than welcome to have your own. I’m not going to hate you or think any less of you if you don’t use them. I’m just not going to like reading your code (unless you’re a pro with comments because clear commenting makes everything better).

If you feel strongly about not using them for a particular reason, tell me why and we may just learn something new.

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.