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

The exponentiation assignment operator (**=) raises the value of a variable to the power of the right operand.

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

语法

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

Examples

Using exponentiation assignment

// Assuming the following variable
//  bar = 5

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

Specifications

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

Browser compatibility

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

See also