JavaScript variable definition: Commas vs. Semicolons

No performance benefit, just a matter of personal choice and style.

The first version is just more succinct.


Update:

In terms of the amount of data going over the wire, of course less is better, however you would need a hell of a lot of removed var declarations in order to see a real impact.

Minification has been mentioned as something that the first example will help with for better minification, however, as Daniel Vassallo points out in the comments, a good minifier will automatically do that for you anyways, so in that respect no impact whatsoever.

Leave a Comment