News for hackers. Stuff that matters.
Re:“It is never a compiler error” by harry8 on Tuesday November 14, 2017 @10:31PM (#15701248)
if(foo) <- js can insert semicolon there

if(foo) { <- js cannot insert semicolon there

Edit: add this comment you have provided approximately nothing in support of your assertion, you can and should do better. I note this thread is JS and a whole lot of this kind of thing going on here I don't usually see elsewhere on HN. It's a shame, discussion is useful to learn things I don't already know. "Nyer, your wrong" not so useful to me, you or anyone else.

Re:“It is never a compiler error” by inimino on Thursday November 16, 2017 @02:04AM (#15710732)
No, JS will never never insert a semicolon after “if(foo)” no matter what comes after it. Putting the braces on your control structures on the same or the next lines has no interaction whatsoever with the semicolon insertion rules.

I’ve written a ridiculously detailed blog post about automatic semicolon insertion if you want to know all the specifics.

http://inimino.org/~inimino/blog/javascript_semicolons

Re:“It is never a compiler error” by 0xcde4c3db on Wednesday November 15, 2017 @12:43AM (#15701705)
There's a similar pattern in Go's semicolon insertion, although I think the exact rules differ.