Skip to content

Comment on Semicolons in JavaScript are optional

Comments

  I write semicolon-less code and,
  in my experience, there isn't a 
  JavaScript interpreter that can't 
  handle it.
Come visit me at work and I'll show you a few JS implementations on various set-top-boxes that will freak out if you don't use semicolons.

So in essence, the problem is still to be blamed on those specific JS implementations. Optional means optional, at which point making an implementation that demands the absence of semicolons is as bad as one explicitly requiring them, as both are breaking the set rule: optional.

(personally, I'm for the mandatory semicolon, to avoid mistakes)

Yep, those implementations are crappy, but they are in production and deployed in hundreds of thousands of end-user systems. The author seems to have only been testing PC web browsers, which is not the only place JS is used. This is easy to forget, though.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.