Trailing Comma,

Find trailing commas in your Javascript. Fix IE Fast.


This site is to help web developers overcome a massive headache when developing javascript. If you're not a webdeveloper, you can probably stop reading now. In Internet Explorer 6 and 7, there is an easy to introduce javascript bug relating to commas. If, when defining an array or an object, you leave a trailing comma after the last item in your collection, IE will fail to parse your javascript file:

var x = [1,2,3,]; //ERROR
var y = {'a': 1, 'b': 2, 'c': 3,}; //ERROR

Unfortunately, this mistake is very easy to make but very hard to track down in large javascript projects.


Countless working hours are wasted trying to debug trailing comma errors. My hope in providing this site is to spare those hours, saving developers time and frustration. Please consider donating a dollar or two (or more!) If this site saves you even an hour's worth of work, that's a considerable amount of frustation for such a small thing.

As an added bonus, if you donate a dollar or more, you'll get an API key that will allow you to a make simple web request and get back an easily digestible response containing info about trailing commas. Combine it with your test framework and be alerted immediately when you've checked in buggy Javascript.


The API for Trailing Comma is stupidly simple. POST your code as the body of your request to<API_KEY> and it will return back a simple JSON array containing data detailing any trailing commas it finds. If there are no trailing commas, it will return an empty array.

You can obtain an API key by donating just a dollar (or more!) towards the cost of running this service.

Sample Request

POST /check?key=foobar HTTP/1.1
Content-Length: 11
var x=[1,];

Sample Response

HTTP/1.1 200 OK
Date: Fri, 16 Dec 2011 23:59:59 GMT
Content-Type: application/json
Content-Length: 41

Simple Command Line Validation via Curl

# curl -d @myfile.js