Are trailing commas in arrays and objects part of the spec?

后端 未结 6 1206
暗喜
暗喜 2020-11-22 10:26

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 encount

6条回答
  •  北荒
    北荒 (楼主)
    2020-11-22 11:07

    Just a quick reminder/warning that this is one of the areas in which the JavaScript/ECMAScript standard and JSON standard differ; trailing commas are valid in JS but not valid in JSON.

提交回复
热议问题