Extra comma in JS

0 like 0 dislike
4 views
A dispute arose about the errors in IE, if there is extra comma in the code.
The situation is simple:
items: [
{xtype: 'textfield', cls: 'fake-field', value: 'Manager Login'},
new Ext.form.TextField(Ext.applyIf({fieldLabel: 'Username', name: 'login', allowBlank:false}, fieldConfig)),
this.passwordField,
this.passwordConfirmField,
new Ext.form.Hidden({name: 'companyId'}),
]

If last comma is not clean — IE script doesn't work. All other browsers will work on hurrah.
Question: Who is right? The encoder and the comma (with all browsers) or IE (which doesn't want to handle an obvious mistake of the programmer).
by | 4 views

7 Answers

0 like 0 dislike
in my unprofessional opinion wrong programmer. The comma is clearly superfluous here, in what grammar nor think.
by
0 like 0 dislike
by
0 like 0 dislike
Commas at end of enums to be!
And IE... Well, he was always "special."
by
0 like 0 dislike
Generally understood: in the 5th edition of ECMA-262 commas are allowed, but browsers only support 3 of an edition in which commas are not allowed.
by
0 like 0 dislike
Wrong proger, and we have to work somehow, many of those wrong.
And not only in JS
probably because people are not Serniki and not even Pascalite — and any "normal" languages, any violation of the syntax hard to kill.
And are taught not to write too much PTA very quickly
by
0 like 0 dislike
wrong IE because, according to the standards, comma at the end of can stand. this is done for ease of programming and code generation
by
0 like 0 dislike
Array-(Array) in IE (even 6) it seems this is not a problem, as for objects used as associative arrays, since IE8 is already fixed:
\r
var obj = { 'lorem' : 'first', 'ipsum' : 'second', };

Total, of the rights of the programmer, but because IE6-7 while it is necessary to do the uncomfortable — without a comma after the last element.
by

Related questions

0 like 0 dislike
1 answer
0 like 0 dislike
2 answers
asked May 22, 2019 by codeZlo
0 like 0 dislike
1 answer
110,608 questions
257,186 answers
0 comments
1,117 users