DEV Community

Cover image for The new features of Javascript in 2020 (ES11)

The new features of Javascript in 2020 (ES11)

Ary Barros on September 20, 2020

Javascript is a sensation, largely due to the explosion of web development today. Many are inserted in it and others, at one time or another, will ...
Collapse
 
pentacular profile image
pentacular •

I think it's worth noting that your dynamic import example relies on top-level await.

let Dmodule;
if ("react") {
  Dmodule = await import('react')
} else {
  Dmodule = await import('vue')
}

I think this is still a proposal isn't it?

Anyhow, probably worth-while not complicating your example with it. :)

Collapse
 
aryclenio profile image
Ary Barros •

Hy pentacular. Thanks for the reply and I agree with you. I've changed the example so it better fit the main explanation.

Collapse
 
daviddalbusco profile image
David Dal Busco •

I love the dynamic import feature, I use it to dynamically import CSS πŸ˜ƒ

Thank you for your blog post, a nice read and summary πŸ‘

Collapse
 
aryclenio profile image
Ary Barros •

Thanks for reading David :)

Collapse
 
king11 profile image
Lakshya Singh •

Didn't we already have a Promise.all() what's the difference

Collapse
 
sireaev profile image
sirev •

Yes, we did. The difference is that Promise.all() didn't resolve the promises from array in then if it had at least one rejected.

Promise.all([Promise.resolve('resolved'), Promise.reject('rejected')]).then((r) => console.log(r)).catch(() => console.log('catch here!'));
Output
// catch here!

Promise.allSettled([Promise.resolve('resolved'), Promise.reject('rejected')]).then((r) => console.log(r)).catch(() => console.log('catch here!'));

Output
// [
// { status: "fulfilled", value: 'resolved' },
// { status: "rejected", reason: 'rejected' }
// ]

Collapse
 
king11 profile image
Lakshya Singh •

Ohh cool thanks for clarifying :))

Collapse
 
uzitech profile image
Tony Brix •

The first example in Nullish Coalescing Operator the values should be switched around the ||s

You have 'value not falsey' || undefined which should actually be undefined || 'value not falsey', otherwise "value not falsey" will always show even for a truthy value.

('value not falsey' || true) === 'value not falsey'

Collapse
 
andrewbaisden profile image
Andrew Baisden •

BigInt looks interesting.

Collapse
 
rajikaimal profile image
Rajika Imal •

Great article, there's a typo in Promise.AllSettled example, 2nd line: first "Promise.resolve"

Collapse
 
aryclenio profile image
Ary Barros •

Thanks for the reply Rajika. I've fixed the typo.

Collapse
 
ephraimduncan profile image
Ephraim Duncan •

I like the optional chaining feature.

Collapse
 
aryclenio profile image
Ary Barros •

Thanks for reading Ephraim :)