--- title: Multiplication assignment (*=) slug: Web/JavaScript/Reference/Operators/Multiplication_assignment translation_of: Web/JavaScript/Reference/Operators/Multiplication_assignment ---
{{jsSidebar("Operators")}}

The multiplication assignment operator (*=) multiplies a variable by the value of the right operand and assigns the result to the variable.

{{EmbedInteractiveExample("pages/js/expressions-multiplication-assignment.html")}}

语法

Operator: x *= y
Meaning:  x  = x * y

Examples

Using multiplication assignment

// Assuming the following variable
//  bar = 5

bar *= 2     // 10
bar *= 'foo' // NaN

Specifications

Specification
{{SpecName('ESDraft', '#sec-assignment-operators', 'Assignment operators')}}

Browser compatibility

{{Compat("javascript.operators.multiplication_assignment")}}

See also