News for hackers. Stuff that matters.
Re:Regarding JavaScript trailing commas by scardine on Friday April 08, 2016 @11:16PM (#11459716)
I'm a Python programmer. In Python, trailing comma are idiomatic, so I welcome this.

Perhaps I'm just a lazy bastard, but it makes cut & paste a lot easier.

Re:Regarding JavaScript trailing commas by ergothus on Friday April 08, 2016 @11:51PM (#11459807)
Ditto, from the Perl side of things. I'm a JS coder for the last few years, and I find I really hate a lot of the style conventions - they seem much more oriented towards "because I said so" than "because it's actually better".
Re:Regarding JavaScript trailing commas by nostrademons on Saturday April 09, 2016 @02:19AM (#11460175)
Many common JS conventions are because they were critically important at a.) the time the lead programmer learned Javascript or b.) the time the codebase was originally written.

Trailing commas are certainly in that category. When I started getting into JS seriously in 2007, this wasn't a nitpick: your code would be outright broken in IE6 if you had a trailing comma, and would fail with a syntax error. This was a leading cause of IE bugs, since developers often developed in Chrome or Firefox (which handled them fine) and it was ridiculously difficult to trace it down.

Ditto a lot of other conventions. It was common to use innerHTML instead of DOM manipulation because IE was ridiculously slow at DOM manipulation (React just fixed this in their codebase this week). It was common practice to wrap every file in a closure because all your variables would pollute the global scope - now we have CommonJS modules and bundlers to handle this. It was common to avoid closures in favor of prototypes & _ naming conventions because Firebug & Chrome Devtools couldn't inspect variables in closures.

All of these are terribly obsolete now, and there's no reason to adopt them on a new green-field project. But the point of coding conventions is uniformity with existing code, so if you're inheriting a codebase that was written when these were actually important, it's often good to conform just for consistency's sake.

Re:Regarding JavaScript trailing commas by karlshea on Friday April 08, 2016 @11:33PM (#11459771)
Same with PHP.

I'd love to start using trailing commas in JS, but I've definitely had syntax error problems and unparsable JSON from them existing in recent memory.

Re:Regarding JavaScript trailing commas by striking on Friday April 08, 2016 @11:48PM (#11459798)
This might be happening if you haven't updated your JS tools (although JSON is a different beast altogether). Look into fixing it, you'll be having way more fun once you've done so.