Actually,
var var1 = 1, var2 = 1, var3 = 1;
is not equivalent to:
var var1 = var2 = var3 = 1;
The difference is in scoping:
function good() {_x000D_
var var1 = 1, var2 = 1, var3 = 1;_x000D_
}_x000D_
_x000D_
function bad() {_x000D_
var var1 = var2 = var3 = 1;_x000D_
}_x000D_
_x000D_
good();_x000D_
console.log(window.var2); // undefined_x000D_
_x000D_
bad();_x000D_
console.log(window.var2); // 1. Aggh!
_x000D_
Actually this shows that assignment are right associative. The bad
example is equivalent to:
var var1 = (window.var2 = (window.var3 = 1));