It is saved, so it is similar to the first example. Take for example this code:
var v = 0;
v = ++v + ++v + ++v;
// Returns 6
That is because this will translate to:
v = (0+1) + ((0+1)+1) + (((0+1)+1)+1);
Or, to be more accurate:
v = 0+1 +
v = 1+1 + //Previous value of v + 1
v = 2+1 //Previous value of v + 1
Why?
++v
will first save the incremented value of v, then it will return this incremented value.
To simplify things, try this in your console:
x = 0;
++x;
If ++x
would resolve to x + 1
, the value of x
would now still be 0
, right?
Nope, your x
will be 1
. This means that ++x
must have a assignment operator in there.