3 ms·
Absolutely! For Javascript at least, putting the { on the same line as the thing that caused it is pretty much the only rational policy. The weird thing is ju
by IsaacSchlueter 18y ago
Absolutely! For Javascript at least, putting the { on the same line as the thing that caused it is pretty much the only rational policy.
The weird thing is just how the interpreter handles this:
return;
{
a: "foo";
}
That's a null return, a block (not that JS supports block-level scope, so blocks are pointless), a labeled line (line-labels aren't actually used for anything, since there's no GOTO), and on that labeled line, there's a string expression that does nothing.
So, this is really like 4 different warts working together, but semicolon insertion is by far the most insidious.
Also, liberal use of parens can help prevent semicolon insertion bugs.