this post was submitted on 15 Sep 2023
445 points (84.2% liked)
Programmer Humor
19503 readers
1230 users here now
Welcome to Programmer Humor!
This is a place where you can post jokes, memes, humor, etc. related to programming!
For sharing awful code theres also Programming Horror.
Rules
- Keep content in english
- No advertisements
- Posts must be related to programming or programmer topics
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Who uses semicolons in Javascript?
Programmers who care about best practices. Here are a couple of scenarios where not using a semicolon will bite you in the ass.
~95% of the JS code you see on the Web has semicolons. Apparently, a lot of programmers think it's worth that extra keystroke to avoid these types of bugs. I agree with them. The difficulty with programming isn't "Arrgh, there are too many keystrokes, my hands are tired!" It's "Arrgh, HTF did this bug get in here?!?"
I don't even bother typing them because I like having eslint do it for me.
They made it a named function, but this is literally how you format anonymous functions in js, a key feature that usually gets called with stuff like an
onclick
oronload
call in the html domain.Every real programmers
In that sentence, we use "programmer" singular, because "every" is singular, though referring to many
It's pretty arbitrary
Old habits die hard. Learned JS, CSS and C++ all the same year about a decade ago.
People who like minimizing the amount of bug fixing.
I use prettier which by default adds semicolons. Coming from predominately doing backend stuff (mostly in Java) I don’t really mind, especially when the formatter adds them for me
That's what I do too, but i don't manually add them