JavaScript Assignment Operator With Example

JavaScript Operator Definition

An operator that performs some operation on single or multiple operands and produces a result is called Operators.

An Operators are symbols or keyword that enable JavaScript to perform some sort of actions.


JS Assignment Operators

An assignment operators perfoms an operation of assigning values to left operand based on right operand. equal (=) operators is used to assign a values.

Operator Description Example Is The Same As
= Assign x = y x = y
+= Add and assign x += $ x = x + y
-= Subtract and assign x -= y x = x - y
*= Multiply and assign x *= y x = x * y
/= Divide and assign quotient x /= y x = x / y
%= Divide and assign modulus x %= y x = x % y

Example:


Result:

10
50
30
125
5
10 


Read Also: