News for hackers. Stuff that matters.
Re:“It is never a compiler error” by krallja on Tuesday November 14, 2017 @10:31PM (#15701249)
Compare the values of these function bodies:

    return {
    };
and

    return
    {
    };
Re:“It is never a compiler error” by inimino on Thursday November 16, 2017 @01:35AM (#15710645)
Yes, those are different, but K&R brace is a style of where you put the braces in a function body or a block. The braces in your example are creating an object literal.

The K&R brace style is not about putting an object literal on the same line with a return statement or on another line, but about how control structures are formatted.

The reason I said that K&R brace style has nothing to do with semicolon insertion is that it’s possible to write all your control structures with K&R braces and still be bitten by the places in the grammar where line breaks are not allowed, like after a return statement, if you’re unaware of it.

It’s also possible to use Allman braces everywhere and never have that problem with return statements.

Re:“It is never a compiler error” by harry8 on Tuesday November 14, 2017 @10:39PM (#15701277)
That is a better example, thanks. I make no claims to JS guru-dom!