JavaScript Assignment Operators
The Assignment Operator is used to assign the value of the right operand to the left operand. The key rule for this operator is that it always assign value from right to left.
The Assignment operator (=) works as (x=y) the y operand assigns its value to x operand, this is the basic use of Assignment operator but we can perform any Arithmetic operation on the right side and assign the value to left as:
x += y same as x = x + y
x -= y same as x = x - y
x *= y same as x = x * y
x /= y same as x = x / y
x %= y same as x = x % y
In the above examples the results of the arithmetic operations are assigned.
0 Comment(s)