As a programmer, we can only put the best performant code to the project when we know what new APIs recently introduced in the technology which is being used into the project.
Lets see ES2021’s important features which we should know and could start using into project.
String replaceAll() method
Prior to ES2021, there was no direct way to replace all occurrences of a string. ES2021 has introduced replaceAll so it is very simple to achieve it.
This is very nice implementation added by ES2021. It can be used to run multiple promises in parallel. It gets resolved when any of the promise gets resolved or it throws “AggregateError” when all the promises gets rejected.
This can also be used to run multiple promises in parallel but it gets resolved once any of the promise is settled irrespective whether resolved or reject.
Logical assignment operator
The logical assignment operator combines Logical Operators and Assignment Expressions, allowing you to write a shorter syntax for variable value checking.
This feature literally improves developer experience by enabling developers to make their numeric literals more readable by creating a visual separation between groups of digits. It’s similar to the way we use commas to separate numbers in writing.
I hope this article will help you to understand ES2021 features better.
Note-We can now start utilizing these features into Angular/React/Vue etc framework based applications, we just need to update the compiler version and TS version wherever applicable.