JS Assignment Operators
Syntax
Assignment operators in JavaScript assign values to variables and can also perform operations like addition, subtraction, etc., combined with assignment.
+= // Addition assignment-= // Subtraction assignment*= // Multiplication assignment/= // Division assignment%= // Modulus assignment**= // Exponentiation assignmentExample
let number = 20;
number += 10; // 20 + 10 = 30console.log("After +=: " + number);
number *= 2; // 30 * 2 = 60console.log("After *=: " + number);
number %= 7; // 60 % 7 = 4console.log("After %=: " + number);