The difference between x-- and --x: 1. [--x] decrements the value of x by 1 first, and then calculates the value of x; 2. [x--] calculates x first value, and then decrement the value of x by 1.
##The difference between x-- and --x:
- -x means that the value of x is decremented by 1 first, and then the value of x is calculated.
x-- is to first calculate the value of x, and then decrement the value of x by 1.
var x = 10; console.log(x--); console.log(x);
10 9
var x = 10; console.log(--x); console.log(x);
9 9
The above is the detailed content of What is the difference between x-- and --x. For more information, please follow other related articles on the PHP Chinese website!