es6+

一、es7(es2016)新特性:https://blog.csdn.net/gongch0604/article/details/88065299

  1、Array.prototype.includes:表示某个数组是否包含给定的值,与字符串的includes方法类似

  2、指数运算符:

2 ** 2 // 4
2 ** 3 // 8

二、es8(es2017)新特性:https://blog.csdn.net/weixin_42437900/article/details/87981967

  1、Async/Await:

  2、Object.values():遍历对象的属性值,无需使用使用属性名。

  3、Object.entries():遍历对象的属性名和属性值。

  4、Object.getOwnPropertyDescriptors():获取一个对象的所有自身属性的描述符。

  5、padStart():用另一个字符串填充当前字符串(如果需要,多次),直到结果字符串达到给定长度。

  6、padEnd():用一个字符串填充当前字符串(如果需要的话则重复填充),返回填充后达到指定长度的字符串。

三、es9(es2018)新特性:https://blog.csdn.net/weixin_42437900/article/details/88018848

  1、异步迭代:

  2、Promise.finally():

  3、Rest/Spread 属性:

  4、正则表达式命名捕获组:

  5、正则表达式反向断言(lookbehind):

四、es10(es2019)新特性:https://www.jianshu.com/p/4cd2fc6afcb7

  1、Array.prototype flat, flatMap:

  2、Object.fromEntries:

  3、String.protope.{trimstart, trimEnd}: trimStart和trimEnd,可以分别去除头和尾上的空格、换行符等。(es5中有 trim 方法,去除前后的空格、换行符等)

  4、可选的catch参数:

  5、Function.prototype.toString

五、es11(es2010)新特性: 参考链接

  1、Promise.allSettled:

  2、可选链 :方便了,对 接口返回来的数据,进行校验。

  3、空值合并运算符 :

  4、dynamic-import(按需加载):

  5、globalThis:

  6、BigInt:

  7、String.prototype.matchAll :

原文地址:https://www.cnblogs.com/wfblog/p/12154766.html