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

猜你喜欢

转载自www.cnblogs.com/eret9616/p/12143031.html