In terms of style, and in terms of version control, either of these are
fine:
```js
const obj = {
x: 10
y: 23
};
// or
const obj2 = {
x: 10,
y: 23,
};
```
The mixed case is the most obnoxious one:
```js
const bad = {
x: 12,
y: 7
}
```
However, as pointed out, there is ambiguity with:
```js
const obj = {
get
x: 10
y
z: 24
get
myMethod() {
}
}
```
I just don't see optional comma in a collection as a useful feature for the
language -- "whitespace matters" always makes me uncomfortable, especially
since there are different standards for line breaks across machines
(looking at you `\r\n`), whereas the `,` token, which is already used to
delineate arguments, is suited exactly for this job.
The one thing I still have a gripe over is the class definition syntax --
where neither `,` or `;` are used at the end of method expressions.
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss