This is called a complex statement. They are common to all languages ββthat I can use: Javascript, C, Java, PHP, .net, GL.
As everyone said, this is an abridged version of value = value + 3 .
There are several reasons for using it. Most obviously, writing is faster, reading is easier, and errors are detected faster.
Most importantly, the complex operator is specially designed so as not to require as many calculations as the equivalent of value = value + 3 . I'm not quite sure why, but evidence is of the utmost importance.
Just create a loop by looping, say, 5,000,000, adding a value as you continue. In two test cases, I know personally from Actionscript, with about a 60% increase in speed with compound statements.
You also have an equivalent:
+= : addition
-= : subtraction
/= : multiplication
*= : multplication
%= : module
and all the less obvious:
++ : plus one
-- : minus
source share