Should we write
var a = [ 'a', 'b', 'c', ];
var b = { '1', '2', '3', };
or
var a = [ 'a', 'b', 'c' ];
var b = { '1', '2', '3' };
What is the most correct way?
I’ve noticed that old versions of IE raise error if there is comma expecting there would be a another array item (or property) after comma.
That is reason enough to not put a comma after the last element! However, it is valid to do so.
Note however that your 2nd example…
…will throw a syntax error. I’m guessing you intended to make it an object literal, but just made a mistake when writing the question: