Web/JavaScript/Reference/Operators/Exponentiation assignment

From Get docs


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



The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request.

Syntax

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
ECMAScript (ECMA-262)The definition of 'Assignment operators' in that specification.

Browser compatibility

Update compatibility data on GitHub

Desktop Mobile Server
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet Node.js
Exponentiation assignment (x **= y) Chrome

Full support 52

Edge

Full support 14

Firefox

Full support 52

IE

No support No

Opera

Full support 39

Safari

Full support 10.1

WebView Android

Full support 51

Chrome Android

Full support 52

Firefox Android

Full support 52

Opera Android

Full support 41

Safari iOS

Full support 10.3

Samsung Internet Android

Full support 6.0

nodejs Full support 7.0.0


Full support 7.0.0


Full support 6.5.0

Disabled'

Disabled' From version 6.5.0: this feature is behind the --harmony runtime flag.

Legend

Full support  
Full support
No support  
No support
User must explicitly enable this feature.'
User must explicitly enable this feature.


See also