I know what the prefix / prefix increment / decrement operators do. And in javascript this doesn't seem to be different.
So far, I can easily guess the outcome of this line:
var foo = 10; console.log(foo, ++foo, foo, foo++, foo);
how operators are ++displayed in separate expressions.
This gets a little complicated as these operators appear in a single expression:
var foo = 10; console.log(foo, ++foo + foo++, foo);
var foo = 10; console.log(foo, foo++ + ++foo, foo);
var foo = 10; console.log(foo, foo + ++foo, foo);
and my question is: how did Javascript (V8 in this case when I tested them in Chrome) end up evaluating the add expression in the second and third examples differently?
Why value fooends differently than foo++. Should postfix be ++incremented after an expression and evaluated only fooinside the expression?