Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

3
  • I'd be interested to know why this has received downvotes. JavaScript doesn't need semi-colons to terminate statements; it can certainly use them, but they are by no means a requirement. If they were needed, then nobody else's explanations would work. The fact(yes, a fact) that you can write an entire JavaScript application with few to no semicolons demonstrates this. Beyond that, I don't see how understanding how a tool works and using one's own reasoning to make decisions is somehow objectionable in contrast to "just do it". That's what's known as religion. Commented Aug 27, 2015 at 23:28
  • 7
    I didn't downvote, but the issue might be that this is factually not correct as written. Newlines are not considered statement terminators in javascript. You can leave off semicolons because of a feature called automatic semicolon insertion which allows it to fix parse errors automatically in certain circumstances. The people who advocate semicolons argue that many javascript programmers seem to poorly understand this rule. Your post seems to be an argument in their favor in that light. (In fairness, I mostly agree with your thesis, but for different reasons) Commented Apr 26, 2018 at 21:13
  • 1
    @TimSeguine Yeah, I wrote this back before I had a better understanding. I still don't think it's objectively wrong to not use semicolons so long as the people doing so understand what exactly it is that they're doing. I should rework my post, or perhaps get rid of it since enough others have chimed in about this. Thanks for the polite criticism! :) Commented Apr 26, 2018 at 23:21