🔰trailing comma
single trailing comma is allowed in array literal / object literal.
let arr = [ 1, 2, 3, ]; // 💡 single trailing comma allowed,
// ^ // won't create "undefined element".
let obj = { name: 'Joy', age: 17, }
// ^ <---- trailing comma
💾 replit:undefined elements in array literal
Last updated
Was this helpful?