The ECMAScript standard allows trailing commas in array and object literals which are ignored. However, older versions of Internet Explorer do not recognize this syntax. Moreover, it can lead to confusion when used in array literals, since spurious commas other than the last one are not ignored but give rise to additional undefined array elements. For these reasons, trailing commas should always be avoided.

Remove the trailing comma.

The following code snippet shows an object literal with a trailing comma, which should be removed.

  • Ecma International, ECMAScript Language Definition, 5.1 Edition, Sections 11.1.4 and 11.1.5. ECMA, 2011.