Web/JavaScript/Reference/Operators/Exponentiation assignment
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
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Update compatibility data on GitHub
Desktop | Mobile | Server | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
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' From version 6.5.0: this feature is behind the |
Legend
- Full support
- Full support
- No support
- No support
- User must explicitly enable this feature.'
- User must explicitly enable this feature.
See also
Exponentiation assignment (**=) by Mozilla Contributors is licensed under CC-BY-SA 2.5.