|
|
|
|
|
by thetrendycyborg
5234 days ago
|
|
This is utterly stupid. And the example he cites for why he prefers an odd function syntax doesn't cause errors..... if you use semicolons. JavaScript interpreters insert semicolons. If you abuse this, you'll end up with unpredictable results like his function example. |
|
You might not know that the return statement is a restricted production, but you do know when you shouldn't immediately follow it with a linebreak.
Similarly, if you see a line beginning with ( or [ which isn't a continuation of the statement on the previous line, stick a semicolon in front of it, or in the case of a wrapped function() {}, use one of the other means of telling the parser it's a function expression. There are other restricted productions, but you just solved every non return-followed-by-linebreak ASI issue I've ever seen in the wild.