Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6468365
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T05:52:59+00:00 2026-05-25T05:52:59+00:00

Are trailing commas standard in JavaScript, or do most browsers like Chrome and Firefox

  • 0

Are trailing commas standard in JavaScript, or do most browsers like Chrome and Firefox just tolerate them?

I thought they were standard, but IE8 puked after encountering one—of course IE not supporting something hardly means it’s not standard.

Here’s an example of what I mean (after the last element of the books array):

var viewModel = {
    books: ko.observableArray([
        { title: "..", display: function() { return ".."; } },
        { title: "..", display: function() { return ".."; } },
        { title: "..", display: function() { return ".."; } }, // <--right there
    ]),
    currentTemplate: ko.observable("bookTemplate1"),
    displayTemplate: function() { return viewModel.currentTemplate(); }
};
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T05:52:59+00:00Added an answer on May 25, 2026 at 5:52 am

    Specs: ECMAScript 5 and ECMAScript 3


    Section 11.1.5 in the ECMAScript 5 specification:

    ObjectLiteral :
        { }
        { PropertyNameAndValueList }
        { PropertyNameAndValueList , }
    

    So yes, it is part of the specification.

    Update: Apparently this is new in ES5. In ES3 (page 41), the definition was just:

    ObjectLiteral :
        { }
        { PropertyNameAndValueList }
    

    For arrays literals (Section 11.1.4) it is even more interesting (Update: this already existed in ES3):

    ArrayLiteral :
        [ Elisionopt ]
        [ ElementList ]
        [ ElementList , Elision_opt ]
    

    (where Elision_opt is Elisionopt, meaning the Elision is optional)

    Elision is defined as

    Elision :
        ,
        Elision ,
    

    So, an array literal like

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

    is perfectly legal. This creates an array with two elements but sets the array length to 2 + 3 = 5.

    Don’t expect too much from IE (before IE9)…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to remove a trailing slash from a string. For example if
I have read somewhere that the C++ standard does not allow something like enum
I have a javascript code, containing an array with trailing comma items:[{ id: 'col-1',
Many programming languages allow trailing commas in their grammar following the last item in
I have created a fairly large Javascript app that works in Firefox and up
How do I remove a trailing comma from a string in ColdFusion?
I want to trim trailing whitespace at the end of all XHTML paragraphs. I
I am getting 'trailing whitespace' errors trying to commit some files in Git. I
What is the best way to make trailing slashes not matter in the latest
I need to convert strings with optional trailing signs into actual numbers using Powershell.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.