Leading comma style good for JavaScript?

Hey r937’s leading comma style could be moving from SQL to JavaScript.

It does make errors easy to see, but is it really worth changing your coding style over? Are errors with commas really that big a deal?

Since those errors can be the hardest ones to spot and the code may still appear to work with the comma missing but may not do what you expect. Anything you can do to make it easier to spot is worthwhile.

I have seen quite a few pieces of JavaScript written using comma first over the past few years.

It’s a good idea, but it certainly isn’t a new one. I’ll always opt for whatever I think is more readable. I won’t be changing to the comma-first style because, for me, it’s less readable. Also, the IDEs I use will flag errors like the ones being prevented by the comma-first syntax, so there’s really no point in me changing.

they are, yes, if you get an error and cannot figure it out and end up posting on a forum only to be told you messed up a comma

thanks for the attribution, by the way

however, like the single-pixel gif, i wasn’t the only one to invent this


It’s a very nice idea. Definitely worth trying, but I think I’m not going to get used to that style :stuck_out_tongue: