Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new features of ES2016 #20

Open
xhlwill opened this issue Jun 9, 2017 · 0 comments
Open

new features of ES2016 #20

xhlwill opened this issue Jun 9, 2017 · 0 comments

Comments

@xhlwill
Copy link
Owner

xhlwill commented Jun 9, 2017

相对于 ES2015(民间习惯称作 ES6,知道你们看过阮老师的《ES6 标准入门》 🤦‍♂️ )的大更新,ES2016 (ES7) 及之后的更新会更加小而频繁(一年一版)。到 2016.1.28 为止所有处于第四阶段的提案都将包括在 ES2016 中(来源于 ES 标准的编辑 Brian Terlson),这意味着 ES2016 除了一些修复外只加了两个新功能:

1⃣️ arr.includes(el) 几乎相当于 arr.indexOf(el) !== -1,用来判断数组中是否含有某元素。只是对于 NaN 的判断行为不一样:[NaN].includes(NaN) === true,但 [NaN].indexOf(NaN) === -1

2⃣️ 对,你们要的幂运算来啦,但是有 bug 😂 ……
这里,Math.pow(99,99) 和 99**99 并不相等啊,SO 上的解释是一个编译时计算、一个运行时计算而造成的结果不一样,oh no,其实这更像是 V8 的 bug,在 chromium 上有人已经上报了,目前最新的 Chrome 58 59 上还没有被修复,所以现在还是老老实实用 pow 吧。

@xhlwill xhlwill added the JS label Jun 12, 2017
@xhlwill xhlwill changed the title the features of ES2016 new features of ES2016 Aug 14, 2017
@xhlwill xhlwill added the ES2016 label Oct 22, 2017
@xhlwill xhlwill added the ES6+ label Jul 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant