Should you use semicolons in JavaScript?

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 t…


This content originally appeared on Zell Liew and was authored by Zell Liew

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.


This content originally appeared on Zell Liew and was authored by Zell Liew


Print Share Comment Cite Upload Translate Updates
APA

Zell Liew | Sciencx (2017-11-03T00:00:00+00:00) Should you use semicolons in JavaScript?. Retrieved from https://www.scien.cx/2017/11/03/should-you-use-semicolons-in-javascript/

MLA
" » Should you use semicolons in JavaScript?." Zell Liew | Sciencx - Friday November 3, 2017, https://www.scien.cx/2017/11/03/should-you-use-semicolons-in-javascript/
HARVARD
Zell Liew | Sciencx Friday November 3, 2017 » Should you use semicolons in JavaScript?., viewed ,<https://www.scien.cx/2017/11/03/should-you-use-semicolons-in-javascript/>
VANCOUVER
Zell Liew | Sciencx - » Should you use semicolons in JavaScript?. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2017/11/03/should-you-use-semicolons-in-javascript/
CHICAGO
" » Should you use semicolons in JavaScript?." Zell Liew | Sciencx - Accessed . https://www.scien.cx/2017/11/03/should-you-use-semicolons-in-javascript/
IEEE
" » Should you use semicolons in JavaScript?." Zell Liew | Sciencx [Online]. Available: https://www.scien.cx/2017/11/03/should-you-use-semicolons-in-javascript/. [Accessed: ]
rf:citation
» Should you use semicolons in JavaScript? | Zell Liew | Sciencx | https://www.scien.cx/2017/11/03/should-you-use-semicolons-in-javascript/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.