I'm just curious about one thing. A little example in Javascript
var a = 1;
a = a++;
console.log(a); // 1
var b = 1;
b = ++b;
console.log(b); // 2
var c = 1;
c += 1;
console.log(c); //2
I understand why it works this way in case b
and c
, but what about a
?
At first the code makes an assignment a = a
, the value stays the same actually, but then it should (as I see) make increment and increase value a
per unit. But this not happening. Why?