Skip to content

Trailing or "Final" commas #192

@ASH-Michael

Description

@ASH-Michael

Should we add a standard for using trailing commas in our JavaScript?

In Arrays?

var arr = [ 1, 2, 3, ];

In Objects?

var object = { 
  company: "ASH", 
  team: "Front End",
};

In Functions?
Only works in ecmaVersion 2017

function f(p) {}
function f(p,) {} 

(p) => {};
(p,) => {};

In Array and Object Destructuring?

let [a, b,] = [1, 2];

let o = {
  p: 42, 
  q: true,
};
let {p, q,} = o;

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions