JavaScript code inspection: catch bogus comma

Ok - maybe I'm going blind - I should have caught this, but I just never saw it. An extra comma cost me a day of debugging time in some code similar to this sample code:

      MyObj = function(param) { this.param = param; };
     
      var myObj = new MyObj([
        {
          id: "1"
        },
      ]);


See the extra comma after the object definition? In Firefox or Safari/Chrome, the length of the param array is 1. IE 6 and 7 report the length as 2, and resulted in some code deep in a 3rd party JavaScript library (Ext JS) to blow up. Is there a way IntelliJ could catch this via a code inspection? Might there already be something like this?

IntelliJ 8.0.1
OS X 10.5.6

0

Please sign in to leave a comment.