JavaScript Assignment Operators
The assignment operator is used to update the value of variables. Some assignment operators are combined with other operators to perform a computation on the value contained in an update of the variable with the new value.
The Assignment Operators are shown as below:
Operator |
Example |
Same as |
= |
a = b |
a = b |
+= |
a += b |
a = a+b |
-= |
a -= b |
a = a-b |
*= |
a *= b |
a = a*b |
/= |
a /= b |
a = a/b |
%= |
a %= b |
a = a%b |
Example
let a = 21;