Exponentiation assignment (**=)

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

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
Chrome Edge Firefox Internet Explorer Opera Safari WebView Android Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet
Exponentiation_assignment
52
14
52
No
39
10.1
51
52
52
41
10.3
6.0

See also

© 2005–2021 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