7 Exciting New JavaScript Features You Need to Know

Mostafa Gaafar on August 05, 2019

This article has been translated to Japanese by @rana_kualu here https://qiita.com/rana_kualu/items/ee7694aa1cd4ae7f4483 JavaScript (or ECMA Scrip... [Read Full]
markdown guide
 

Nice list! Really looking forward to these. I still think private fields prefixed with "#" is crazy and shouldn't have been accepted, but the rest are cool and I can't wait to use them!
Thanks for sharing!

 

I don't get this one either. Why not conform and use private like in both Java, and TypeScript.

This one is mind boggling.

 

I had the same feeling at first. Then I read the reasons behind it and it made some sense. Long story short: in a dynamically typed language, giving the engine a hint whether the property you're trying to access is public or private makes it much easier to implement without exposing details of internal private fields. Here's the reasoning behind it github.com/tc39/proposal-private-f...

Another advantage of it is that linters can also understand if you're trying to access a private property outside its class and warn you, which would be impossible without a special identifier

 

Totally agree. Didn't look at specs to be honest, but why it wasn't problem to introduce static keyword and it is a problem indeed with private? 🤔

 

Agreed on the private field prefix. I kinda hope typescript leaves that one out, but they probably have to include it or they would no longer be a superset of js.

 

Good write-up! I'm especially looking forward to nullish coalescing, as it would've solved an annoying but I just had.

I heard about optional chaining from Kyle Simpson, and it looks useful! I'll likewise enjoy trying that out.

I'm personally not thrilled about private or static stuff, but much like classes, I know they'll help passerby JS developers who already use JS as an OO language. As the language of the web, it's probably better if developers of all types encounter as little friction as possible working with JS.... but I'm still scrunching up my nose at it.

 

I think now that JS has classes, the private and static keywords/symbols are only a natural next step.

Still, I have to agree with some others about the # symbol for private. That's bizarre to me.

On the other hand though, I guess you'll get some kind of indication from outside the class that what you're trying to use is private. Hopefully it's helpful in that regard.

 
 

BigInt in particular is welcome - and the restrictions are there for technical implementation reasons, but in practice they matter less, since you can always convert a Number explicitly to a BigInt. As for the others, they solve some pain points, some specific to JS. Look forward to seeing how people use them.

 

Such a helpful article. I learned a lot. Thank you

 

2, 3 and 6.

thepracticaldev.s3.amazonaws.com/i...

PS: Small grammar thingies:
{
"as long as it's reference" : "its",
"We with optional chaining" : undefined
}

 
 

For us using Typescript these features are not new.

Great nevertheless

 

I was not awere of weak refs. This might be a great performance improvement for modern web applications.

Thanks for sharing!

 
 
code of conduct - report abuse