Division Assignment Operator
In JavaScript, Division Assignment Operator is used find the quotient in the division of the given two operands, and assigns the resulting quotient value back to the first operand.
Syntax
+=
symbol is used for division assignment operator.
Division assignment operator takes two operands, divides the value in left operand with that of the right operand, and assigns the quotient back to the left operand.
a /= 5 //equivalent to a = a / 5
a /= b //equivalent to a = a / b
Examples
1. Divide a
with 5
and assign the quotient back to a
.
var a = 13;
a /= 5;
console.log(a);
2. Divide a
with value in b
and assign the quotient back to a
.
var b = 7;
var a = 16;
a /= b;
console.log(a);