var x = 4;
var x += 8;
// value of x would be 12
Similar to the previous example, this one subtracts the assigned value from its own value.
You can probably guess this one too – it multiplies the assigned value with itself.
Once again, similar to above, this one will divide the assigned value with itself.
This one is a bit more difficult to work your head around, but operates on the same principles as before. This will perform the modulus operation on the assigned value against itself.
Using these assignment operators can save a lot of time. Compare the following statements: