|
|
|
|
|
by mc808
4010 days ago
|
|
AFAIK, return statements are literally the only place where brace style is affected by ASI. var result =
{
key: "value"
};
return result;
works fine, plus it lets you more easily break on the return statement and verify/modify what will be returned when debugging. It would be kind of awkward to see braces like that in JavaScript, but a style guide could just ban returning object literals and make the ASI issue moot (at least regarding braces; you still have the other gotchas with forgetting a comma in a variable declaration, etc). |
|
I hate the asshole at Netscape who decided the browser scripting language had to be modeled after Java (C/C++, in other words), especially when it was clearly meant to be a functional programming language that worked with lists and property lists.
Man, I'm feeling "troll-ish" tonight. Not that I'm lying, just being blunt.