JavaScript Affectation Operators


JavaScript Affectation Operators
This operator allows us to simplify the operation of adding value in a variable and stores the result in the variable itself. This operation is usually written in the following way: x = x +2, using the affectation operation operator can be written into : x+=2, and if the initial value of x=7 then the final value x is 9.

Some operators that is used is as follows:

Operator and Function :
+= Adds value to the left to the right value, then variable stores the result to the left
-= Reducing the value of the left to the right value, then save the result variable left
*= multiply left value and right value, then variable stores the result to the left
/= divide the left value with the right value, then variable stores the result to the left
%= calculate residual values left by the division of the right value, then save the variable to the left

2 comments:

SEO said...

Good information for me. thx..

Top HTML said...

Ok. You're welcome..

Post a Comment