[Javascript] ++operation
What's the output of following code:
let a = 1;
const b = a + ++a * a++;
In Javascript, the code always run from lef to right.
Both ++aand a++ are expression. Every expression has return value.
a++returns 1, then a was assigned to 2
let a = 1;
const b = a + ++a * a++;
// const b = 1 + 2 * 2
// let a = 3

浙公网安备 33010602011771号