Skip to content

Semicolons in JavaScript are optional (2010)

mislav.uniqpath.com
1 pointhnmcs2 comments
On HN

Comments

Only reason I posted this was that I got fooled by the brand-new "search" interface on HN when I was checking if it had been posted before. I got results for only the past 24 hours, but interpreted it as results for all time.

summary / teal-deer:

Provocative author says: you never need semicolons in JS, so don't feel you have to use them. Free your mind from the cargo cult. Provocative author admits that you do need them to get something like this to parse correctly:

  a = b + c
  (d + e).print()
And then recommends using semicolons in this way:
  a = b + c
  ;(d + e).print()
</summary>

Frankly, I'm not persuaded.

AboutSource Built by g1lg1l

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