# [Exponentiation operator](https://babeljs.cn/docs/plugins/transform-exponentiation-operator)
在 ES6 中可以使用 `**` 进行乘方扩展运算,可以使用 `babel-plugin-transform-exponentiation-operator` 进行语法转换。
```
npm install --save-dev babel-plugin-transform-exponentiation-operator
```
## .babelrc 配置
```json
{
"plugins": ["transform-exponentiation-operator"]
}
```
## 使用
### `**`
in
```js
let squared = 2 ** 2;
// same as: 2 * 2
let cubed = 2 ** 3;
// same as: 2 * 2 * 2
```
out
```js
var squared = Math.pow(2, 2);
// same as: 2 * 2
var cubed = Math.pow(2, 3);
// same as: 2 * 2 * 2
```
### `**=`
in
```js
let a = 2;
a **= 2;
// same as: a = a * a;
let b = 3;
b **= 3;
// same as: b = b * b * b;
```
out
```js
var a = 2;
a = Math.pow(a, 2);
// same as: a = a * a;
var b = 3;
b = Math.pow(b, 3)
// same as: b = b * b * b;
```