JavaScript Division Assignment Operator


Division Assignment

+= 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);