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

后端 未结 6 1093
暗喜
暗喜 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:01

    What is even funnier, IE7 gives

    [1,].length  --> 2
    

    while Firefox and Chrome

    [1,].length  --> 1
    

提交回复
热议问题