DEV Community

Cover image for New JavaScript features coming in 2020 that will surely rock your world!!

New JavaScript features coming in 2020 that will surely rock your world!!

Shadid Haque on December 18, 2019

Is this another overly hyped article about JavaScript. Perhaps!!! Maybe after reading this you will share my enthusiasm 😁. In 2020 JavaScript will...
Collapse
 
psnehanshu profile image
Snehanshu Phukon

Optional Chaining is my favorite though.

Collapse
 
swiftwinds profile image
SwiftWinds

Not to mention nullish coalescing. 😍

Collapse
 
gypsydave5 profile image
David Wickes • Edited

So here's an opinion: none of these are at all interesting as 'features'. They don't really extend the language - at best they're sugar over what's there already. The benefits are minor.

The downsides are not insignificant. Extending the language syntax like this means you have to 'know' a lot more magic symbols and incantations in order to 'know' JavaScript. Every extension like this makes it a harder language to learn with, to my view, very little benefit. "Scheme for the browser" has never looked so complicated.

Nice article though.

Collapse
 
fetishlace profile image
fetishlace

If that opinion stands on "lot more magic symbols and incantations in order to 'know' JavaScript" - what does this 'know' means?
Does mastering of JS mean knowing all the features? - I do not think so, there is documentation anyway.
Does mastering of JS mean using all the features? - same answer I guess, no one is using all what is available out there.
"magic symbols and incantations" and "The downsides are not insignificant."? - No, but nice hyperbole. There is documentation, and i cannot think about realistic scenario in which someone knows how to use String.prototype.match() and is unable to get how String.prototype.matchAll() works, or same with Object.entries() and Object.fromEntries() - I think this is just filling holes in something what i would call language 'symmetry' in this case (maybe not so needed, but better to have than to not have :-)).
Anyway are problems in understanding really coming from number of features or more from the usage itself? How long is RegExp there? I am weak in RegExp (my fault), but sometimes i am using it and it is handy, BUT i've seen few professional devs 10+ years in a job staring long minutes into some weird RegExp not knowing how exactly(!) it works...
I agree this is nothing big like ES6. And I also kind of agree than less is more, but not always.
Most of it (all?) is already ready to use in chrome or Babel, optional chaining will be usable, waiting for it coming into chrome, Object.fromEntries() is usable, same with BigInt and Promise.allSettled - i am not even using any framework so cannot comment module import and i am not professional dev anyway, I just do not think things are black or white.

Collapse
 
darkwiiplayer profile image
𒎏Wii 🏳️‍⚧️

I'd say to 'know' javascript implies, at the very least, being handed any snippet of JS code (that's not written specifically to be unreadable) and being able to figure out what it does on a language-level without having to consult the documentation.

This is specially relevant in cases like the ?. operator, which is hard to google when encountered in the wild.

Collapse
 
discobanco profile image
discobanco • Edited

Agree. Let's just stick to C++, or better even, assembly language. Much less to learn!
I do agree this list didn't bring much to the table, though... (except the dynamic runtime imports perhaps?) They're might be more interesting things coming up. Were private fields mentioned here?

Collapse
 
shadid12 profile image
Shadid Haque

Nope I didn't mention that. Think that is still in stage 2..might be mistaken

Collapse
 
avxkim profile image
Alexander Kim

TypeScript 3.7 already has an Optional Chaining:

let x = foo?.bar.baz()

Switch to TS, guys, and you won't have to wait 2020, lol.

Collapse
 
shadid12 profile image
Shadid Haque

😆😆😆 looool

Collapse
 
dreamdealer profile image
Johan van Tongeren

Optional chaining! 🎉

Collapse
 
andredicioccio profile image
Andre DiCioccio

Hell yeah!!!

Collapse
 
danielnetzer profile image
Daniel Netzer

The biggest question is browsers support for those amazing features

Collapse
 
mrsimonemms profile image
Simon Emms

If you use a transpiler (eg, Babel/Typescript), they'll all be available

Collapse
 
andredicioccio profile image
Andre DiCioccio

Optional Chaining is definitely my pick of the bunch here. The amount of time and hassle this will save is fantastic!

Collapse
 
rdewolff profile image
Rom

Thanks for sharing the good news!

Collapse
 
darkwiiplayer profile image
𒎏Wii 🏳️‍⚧️

Funny how those are all things that Ruby has had for ages now (except the promise-related one, which is obviously a javascript-specific feature).

Collapse
 
shadid12 profile image
Shadid Haque

Ohh man I love ruby. Reminds me of good ol days.

Collapse
 
calvinmills profile image
Calvin Mills

Nice piece with succinct examples, great work!

Collapse
 
triptych profile image
Andrew Wooldridge

Thanks for this post! Very useful information!

Collapse
 
weeb profile image
Patrik Kiss • Edited

They all mean nothing to me because I'm such a noob I have no idea how to use such things and what they are good for.

feelsbadman

Collapse
 
shadid12 profile image
Shadid Haque

Everyone has to start somewhere. You will get there eventually. Not too long ago we all were noobs :)

Collapse
 
mrsimonemms profile image
Simon Emms

Agreed. I'm a noob with 15 years experience

Collapse
 
jkhaui profile image
Jordy Lee

Fake it till you make it brah

Collapse
 
jwp profile image
John Peters

Thank you Shadid!

Collapse
 
avantsekai profile image
Shavant Thomas

Hello Optional Chaining!

Collapse
 
jeroenrombouts profile image
Jeroen Rombouts

I was hoping that Temporal would be part of ECMAScript 2020. Sadly, it appears to be only in stage 2 at the moment. github.com/tc39/proposal-temporal