The exponentiation assignment operator (**=
) raises the value of a variable to the power of the right operand.
Exponentiation assignment (**=)
Try it
Syntax
x **= y // x = x ** y
Examples
Using exponentiation assignment
// Assuming the following variable // bar = 5 bar **= 2 // 25 bar **= 'foo' // NaN
Specifications
Browser compatibility
Desktop | Mobile | Server | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | Deno | Node.js | |
Exponentiation_assignment |
52
|
14
|
52
|
No
|
39
|
10.1
|
51
|
52
|
52
|
41
|
10.3
|
6.0
|
1.0
|
7.0.0
6.5.0
|
See also
© 2005–2022 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Exponentiation_assignment