Чтобы лучше это понять, давайте рассмотрим другую переменную
CASE 1
var a = 10;
a = a + (a = 5);
console.log(a); // 15
a = 10;
var b = a + (a = 5);
console.log(a); // 5
console.log(b); // 15
a + (a = 5)
5 + (a = 5) // here a is assigned a value 5 and bracket returns 5
5 + 5 // here value of a is 5
10 // value will be assigned to variable on LHS
СЛУЧАЙ 2
var a = 10;
a = (a = 5) + a;
console.log(a); // 10
a = 10;
var b = (a = 5) + a;
console.log(a); // 5
console.log(b); // 10
(a = 5) + a
(a = 5) + a // here a is assigned a value 5 and bracket returns value 5
5 + 5 // here value of a is 5
10 // value will be assigned to variable on LHS
CASE 3
var a = 10;
a = a + a++;
console.log(a); // 20
a = 10;
var b = a + a++;
console.log(a); // 11
console.log(b); // 20
a + a++ // post increment i.e. it will return the value first and then increment
10 + 10 // where value of a will 10 + 1 i.e. 11
20 // value will be assigned to variable on LHS
CASE 4
var a = 10;
a = a++ + a;
console.log(a); // 21
a = 10;
var b = a++ + a;
console.log(a); // 11
console.log(b); // 21
a++ + a // post increment i.e. it will return the value first and then increment
10 + a // where value of a will 10 + 1 i.e. 11
10 + 11 // as value of a is 11
21 // value will be assigned to variable on LHS