In the Go language, a trailing comma is required when creating a struct object, so in Go a comma is a terminator.
var a mystruct = {
a: 5,
b: 6,
}
In the Rust language, it seems to be good style to treat commas like terminators, but the language also allows them to be like separators, it's up to you.
In JavaScript, it used to behave like a separator only. However, newer versions of JavaScript allow trailing commas.
let a = {
a: 5,
b: 5,
};
- Does the JavaScript spec still consider a comma to be a "separator" (inside object and array literals and function parameter list) or do they now consider it either a "separator" or a "terminator"?
- Is it wrong for me to say that the comma is a "terminator" in the example above?