Modulus Assignment
%=
symbol is used for modulus assignment operator
modulus assignment operator takes two operands, divides (integer division) the value in left operand with that of the right operand, and assigns the remainder back to the left operand
a %= 5 //equivalent to a = a % 5
a %= b //equivalent to a = a % b
Examples
1. find the remainder of a
division by 5
operation, and assign the remainder to a
var a = 13;
a %= 5;
console.log(a);
2. find the remainder of a
division by b
operation, and assign the remainder to a
var a = 9;
var b = 4;
a %= b;
console.log(a);