This content originally appeared on DEV Community and was authored by Animesh Dhanuk
tips for JavaScript 2021 to write optimized code
JavaScript is the front-hand language as we know. JavaScript is using for web designing, mobile apps, game development, crate web servers, and JavaScript is WebSite Scripting Language(WSSL). That's one of the most used languages by developers, programmers, and coders.
1. Use Logical Assignment Operators
Now, In JavaScript 2021 logical operators and assignment operators are combined, so you can use both in the same syntax as below. And That's one of the most used tips for JavaScript 2021 to write optimized code.
OR Operator
The logical OR assignment (X ||= Y) operator only assigns if X is false.
AND Operator
The logical AND assignment (X &&= Y) operator only assigns if X is true.
2. Use Numeric Separators
This is one of the most used operators by developers and programmers when they have a large amount of numbers. When using a separator in number it looks better than an unseparated number. This is one of the best tips for JavaScript 2021 to write optimized code.
3. Use Replace All
The replaceAll() method returns a new string with all matches. It returns any pattern that can be a string. The original string is left unchanged. The syntax of this operator is replaceAll(regexp, newSubstr). That's one of the most used tips for JavaScript 2021 to write optimized code.
4. Use Promise.Any()
The promise.any() method is to resolve your promise() as soon as which is passed by you. If no promise is passed then it returns promise is rejected with an error. That's one of the best tips for JavaScript 2021 to write optimized code.
I Hope You Enjoy The Above Tips. Thank For Reading...
This content originally appeared on DEV Community and was authored by Animesh Dhanuk

Animesh Dhanuk | Sciencx (2021-06-11T09:49:51+00:00) 4 Tips for JavaScript 2021 to write optimized code. Retrieved from https://www.scien.cx/2021/06/11/4-tips-for-javascript-2021-to-write-optimized-code/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.