~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?!?”
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 or onload call in the html domain.
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
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.
deleted by creator
~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