Caniuse: Trailing commas

Created on 31 Dec 2015  路  7Comments  路  Source: Fyrd/caniuse

Suggestion:

 //caniuse.com/#feat=object-literal-trailing-comma
 //caniuse.com/#feat=array-literal-trailing-comma
 //caniuse.com/#feat=function-parameters-trailing-comma

...or something.

Trailing commas in JavaScript object or array literals have vague scary warnings against.

The following resource identifies IE8,IE7,IE6... as the only browsers to worry about for trailing commas in object literals:

Is that true? Is it complete? What about array literals? JSON.parse? jQuery.parseJSON?

Support data suggestion

Most helpful comment

Various types of trailing commas can now be found at https://caniuse.com/#search=trailing%20commas

All 7 comments

+1

+1

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Trailing_commas mentions that JavaScript has allowed trailing commas in arrays since the very beginning, but I agree that it could be useful to have a feature "Trailing Commas In Objects"

Trailing commas in function parameter lists started in ES2017. I can't find any reference for which browsers support that.

...in function parameter lists

Thanks Lane, a 3rd subgenre of dangling commas. I would like to assume function-call and function-definition don't need to be distinguished.

Various types of trailing commas can now be found at https://caniuse.com/#search=trailing%20commas

A nice start, but if I'm reading correctly, none of them say anything about that perennial wacky hold-out, Opera-Mini.

Was this page helpful?
0 / 5 - 0 ratings