ES2020 new feature

Es2020 feture

 

1.globalThis

为了统一在nodejs中的global和webworker中的self

 

 

2.Promise.allSettled()

Const p1 = new Promise((resolve,reject)=>setTimeout())

 

 

 

 

与Promise.all的区别, promise.all遇到reject的时候会抛出错误

但allsettleed会等到resolve或reject

 

3.Nullish Coalescing Operator

 

 

 

 

 

 

现在你可以使用??

 

 

4.Optional Chaining Operator

 

 

// error

 

现在可以使用?.操作符

 

 

5.BigInt

 

 

 

 

 

 

posted @ 2020-01-03 08:11  hh9515  阅读(152)  评论(0编辑  收藏  举报