This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
While the editor does a good job of flagging trailing commas in JavaScript object literals, it does not flag trailing commas in arrays. This is a bug when running in IE.
Just to be sure, do you mean this?: var myObjectLiteral = { 'key1': value, 'key2': value2, //DOES flag } var myArray = ["val1","val2",] //does NOT flag
Yes, you've got it right.
Created attachment 98638 [details] Screenshot displaying the bug
Still not fixed in 6.9 ( NetBeans IDE 6.9 Beta (Build 201004200117 )
Selected by respondents of NetBeans 6.9 Community Acceptance survey as stopper, marking as 6.9.1_CANDIDATE.
Perhaps worth noting that the trailing comma is valid syntactically. Whether it was allowed in ECMAScript 3 (and what it meant if it was) was unclear and different implementations did different things (specifically, IE included an undefined entry in the array at the end, which wasn't unreasonable as that's what two commas in a row does; pretty much everyone else didn't, which also wasn't unreasonable). ECMAScript 5 expressly allows the comma (Section 11.1.4), and expressly defines that it does not cause an undefined entry at the end of the array. IE continues its old behavior up to at least IE8 (JScript 6). Perhaps also worth noting that the trailing comma in an object literal is now valid as well (as of ECMAScript 5, Section 11.1.5). IE8 (JScript 6) no longer chokes on it, though all earier versions do.
Needs to be check in the new JS Editor, when hints there will be implemented.
Fixed in web-main 7699fa5883a5.
Integrated into 'main-golden', will be available in build *201209150001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-golden/rev/7699fa5883a5 User: Petr Hejl <phejl@netbeans.org> Log: #164626 - Trailing commas in Javascript Arrays