punctuator `,`
JS ⟩ grammar ⟩ token ⟩ punctuator ⟩ comma (,)
comma operator (,) - a, b
a, b
array literal - [1, 2, 3].
[1, 2, 3]
object literal - {x: 1, y: 2}.
{x: 1, y: 2}
trailing comma - [1, 2, 3,], {x: 1, y: 2,}.
[1, 2, 3,]
{x: 1, y: 2,}
variable declaration - let a = 1, b = 2;
let a = 1, b = 2;
Last updated 3 years ago