It has become quite common to declare variables in multiple lines in JavaScript. Primarily, when they are initialized later:
var var1 = null,
var2 = null,
var3 = 0;
The "normal" would look like this:
var var1 = null;
var var2 = null;
var var3 = 0;
- Why has multiple declaration of variables in multiple lines become so common?
- What are the differences between the two?
- When should I use one or the other?