1
0
mirror of https://github.com/ruanyf/es6tutorial.git synced 2025-05-28 21:32:20 +00:00

docs(number): edit 指数运算符

This commit is contained in:
Ruan YiFeng 2017-01-26 07:57:35 +08:00 committed by GitHub
parent d0442c38c1
commit 186a84dce7

View File

@ -615,7 +615,7 @@ ES6新增了6个三角函数方法。
## 指数运算符
ES7新增了一个指数运算符`**`目前Babel转码器已经支持
ES2016 新增了一个指数运算符(`**`
```javascript
2 ** 2 // 4
@ -633,3 +633,15 @@ let b = 3;
b **= 3;
// 等同于 b = b * b * b;
```
注意,在 V8 引擎中,指数运算符与`Math.pow`的实现不相同,对于特别大的运算结果,两者会有细微的差异。
```javascript
Math.pow(99, 99)
// 3.697296376497263e+197
99 ** 99
// 3.697296376497268e+197
```
上面代码中,两个运算结果的最后一位有效数字是有差异的。