If you run any syntax checking or minification tools, this will be immediately obvious. If you test your site in IE at all, this will be immediately obvious. If you record JS errors on your site, this will soon be obvious. If you record any kind of usage statistic, this will eventually be obvious.
Take it from someone who has experimented with cutesy formatting in the past[1]: you don't need to use cutesy formatting to solve this problem.
[1 | You can end class declarations with _:0} instead of a bare } to avoid the trailing comma issue. ]
Having mechanisms in place to catch programmer errors is no excuse for adopting practices that make programmer errors more likely.
And it is important in our industry to write MAINTAINABLE code.
I freely remove, add, and move things to the bottom of my js classes without ever hitting trailing semis, or hitting a missing semi. I think that is more maintainable then the alternative
Lists usually grow on the end, not the beginning.
(I use this kind of formatting for SQL, for a similar reason.)
It is an IE bug that causes it to break. One of the many ways they do not follow the spec.
ObjectLiteral :
{ }
{ PropertyNameAndValueList }
With ECMAScript 5 it is legal: ObjectLiteral :
{ }
{ PropertyNameAndValueList }
{ PropertyNameAndValueList , }
So before v5, the other browsers were incorrectly tolerating something that goes against the spec. It's only semi-recently that it's been "allowed" as a valid practice.Not to mention, IE8 was released half a year before ES5 (according to a quick check on Wikipedia). So yes, pre-ES5 I'd say it's a normal thing to do not to allow trailing commas.
Really?
The comma first style makes it less likely that your list will end with a trailing comma, which can cause IE-specific bugs. If you're trying to track down the IE breakage a couple of weeks after you wrote down the code, it can be fun to track down the extra comma. If you don't know that this bug is possible (as I'm guessing you don't), multiply the hair-pulling by 10.
See the cautionary story in http://www.enterprisedojo.com/2010/12/19/beware-the-trailing... for a real life example.
With the comma first style, that bug would never have been introduced. Neat, huh?