question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Trailing commas in Object/Array literal

See original GitHub issue

Are trailing commas good style in javascript? I always use them for convenience.

var tom = {
  name: 'Tom',
  age: 20,
  friends: [
    'Jerry',
  ],
};

Issue Analytics

  • State:closed
  • Created 10 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
hshoffcommented, Feb 4, 2016

@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

0reactions
felixsanzcommented, Feb 4, 2016

@hshoff So now this changed?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found