Trailing commas in Object/Array literal
See original GitHub issueAre trailing commas good style in javascript? I always use them for convenience.
var tom = {
name: 'Tom',
age: 20,
friends: [
'Jerry',
],
};
Issue Analytics
- State:
- Created 10 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Best practices for using trailing commas in JavaScript
A trailing comma, also known as a dangling or terminal comma, is a comma symbol that is typed after the last item of...
Read more >Avoid trailing commas in object or array literals
Using trailing commas in object or array literals reduces code portability due to differences in how different browsers interpret these ...
Read more >Trailing commas in object literals and array literals - 2ality
Quick reminder: trailing commas in object literals are legal in ECMAScript 5, trailing commas in arrays are ignored.
Read more >Are trailing commas in arrays and objects part of the spec?
When there are 2 (plural) trailing commas, only one adds to the length of the array, so it seems more accurate to say...
Read more >10. Trailing commas in function parameter lists and calls
10.2 Trailing commas in object literals and Array literals # ... Why is that useful? There are two benefits. First, rearranging items is...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@felixsanz yup! we switched to Babel which removes trailing commas and we get the added benefit of cleaner diffs. https://github.com/airbnb/javascript#19.2
@hshoff So now this changed?