--- title: Division assignment (/=) slug: Web/JavaScript/Reference/Operators/Division_assignment translation_of: Web/JavaScript/Reference/Operators/Division_assignment ---
The division assignment operator (/=
) divides a variable by the value of the right operand and assigns the result to the variable.
Operator: x /= y Meaning: x = x / y
// Assuming the following variable // bar = 5 bar /= 2 // 2.5 bar /= 'foo' // NaN bar /= 0 // Infinity
Specification |
---|
{{SpecName('ESDraft', '#sec-assignment-operators', 'Assignment operators')}} |
{{Compat("javascript.operators.division_assignment")}}