(function(){
var b1 = b2 = b3 = b4 = 100;
})();
console.log(b1); //100
console.log(b2); //100
console.log(b3); //100
console.log(b4); //100
Here assignment is right associative and hence 100 is assigned.
It is a bad practice. Better version is
(function(){
'use strict';
var b1 = 100,
b2 = 100,
b3 = 100,
b4 = 100;
})();
Question: Is there any case where such wrong assignment
var b1 = b2 = b3 = b4 = 100;
could be preferred or should it never be used?