DEV Community

Cover image for ECMAScript 2021 New Updates

ECMAScript 2021 New Updates

Animesh on June 29, 2021

INTRODUCTION😎 ECMAScript is a part of JavaScript language which is mostly used in web technology, building websites or web apps. ECMAScript is gr...
Collapse
 
ouzkagan profile image
ouzkagan

why are they making it more complicated?

Collapse
 
animeshmaru profile image
Animesh

Hey Ouzkagan,
Some features like Numeric Separators are most awaiting features in JS, these make code more readable.

Collapse
 
khejit68 profile image
khejit68

I too think that things like x &&= 10 could appear more convoluted for other programmers who look at the code. I would just not use the feature to keep things straightforward.

Collapse
 
andreaskol profile image
Andreas • Edited

A solution where there was no problem. Just because you can add a feature doesn't mean you should!

Collapse
 
robertds07 profile image
Robert Damaceno

If you don't understand the purpose of that and try use, it's really complicated, but after some days you will see that feats will optimize your coding time

Collapse
 
juniordevforlife profile image
Jason F

JavaScript is and will be backwards compatible. If you don't have a use for the new features, the old ways will still be present. The new tools are available if you find a use case.

Collapse
 
aemidev profile image
Guillaume C.

In a not-so-near future, it could be used and useful for minifiy process improvements !

Collapse
 
caf3 profile image
Tomas Caetano

Kkkkkkkkkk I thought the same. But that X ??= 10 is really cool.

Collapse
 
calinzbaenen profile image
Calin Baenen

Can you have public counterparts to private properties?
E.g.

class MyClass {
  #priv;
  get priv() {
    return this.priv;
  }
}
Enter fullscreen mode Exit fullscreen mode

Or is JS to primitive to handle it keeping its logic simple?

Collapse
 
animeshmaru profile image
Animesh

Yes, we can have public getter function to get a private properties.

Collapse
 
calinzbaenen profile image
Calin Baenen

I'm specifically referring to them sharing the same name, so the getter can let you do .priv without just giving you (direct) access to .priv.

Thread Thread
 
animeshmaru profile image
Animesh • Edited

Ok, your example is correct. In new update now we can make getter function also private so that it can only be accessed inside the class, but priv in your ex can be get from outside.

Collapse
 
cenacr007_harsh profile image
KUMAR HARSH

Try putting the code in backticks, it makes it more readable.

Collapse
 
animeshmaru profile image
Animesh

Updated!

Collapse
 
lilithkarapetyan profile image
Lilit Karapetyan

Nice post and nice features! It's funny how these simple features may make out lives that much easier. Each week there are at least 2-3 cases when I use3 the x = x || 10 syntaxes, and I think that the new operator will make the code more readable. We had x += 10, x*=10, and why not to have x ||= 10 :D. That's interesting how workarounds people used for writing shorter code are becoming a part of the language specification. I wonder how people coming from other languages will react to these operators :) Not speaking about the res, because there are helpful, too!

Collapse
 
animeshmaru profile image
Animesh


5 mb storage 1956
But nowadays things completely changed..
Same going with these programming languages. 🙂

Collapse
 
davidshoes profile image
David Shoes & Co

Excellent write up. Thank you!

Collapse
 
animeshmaru profile image
Animesh

Welcome David 😊

Collapse
 
joelnwalkley profile image
Joel N. Walkley

When this release is available, how do we update in order to make use of these really helpful features? Will it just be part of my IDE updates?

Collapse
 
devoskar profile image
Oskar Pietrucha

You just update your code and hope that your clients upgrade their browsers as well :) Cheers mate!

Collapse
 
animeshmaru profile image
Animesh

Hey Joel,
JavaScript not requires update as it works in browser, only your browser should support the new ECMA version features. Make sure you works on Chrome browser.

Collapse
 
dastasoft profile image
dastasoft

I have mixed feelings with the nomenclature of the private class methods, I mean the feature is great I used it in TS but I would rather write really private than a symbol :D

Collapse
 
animeshmaru profile image
Animesh

Ya, it has more clear meaning.

Collapse
 
irochkaz profile image
Iryna Zaletko • Edited

Error here, it should be // Output: x = 1; Output: a = 10 prntscr.com/17suwls

Or
let x = 1;
if(x){
x = 10;
}

Collapse
 
animeshmaru profile image
Animesh

Corrected, sorry for mistake. Thank u 😀