Hacker News new | past | comments | ask | show | jobs | submit login

The actual reason that third function compiles, and the fourth does not, is that

    {
      x: 0
    }
is a block statement with a label x. Try it in your console, it returns 0. The last one is an object literal outside an expression, which is a syntax error.

In addition to that, the return statement is 'restricted production' where the line break itself is a terminator, this has nothing to do with semi-colons or ASI.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: