## DEV Community is a community of 660,470 amazing developers

We're a place where coders share, stay up-to-date and grow their careers.

# New Features of JavaScript 2021

Animesh Dhanuk
PHP Developer with 8+ years of experience.
Originally published at cmsinstallation.blogspot.com Updated on ・2 min read

Nowadays we should know about some programming languages like C language, C++, CSS, JavaScript, Python, etc. Today we discuss new features of JavaScript that are very useful for programmers/ coders/ developers.

JavaScript is the easiest programming language to learn for beginners. You can learn it from the tutorial by yourself.JavaScript is the front-end programming language.JavaScript gives some new features in 2021 that are very helpful for developers/ coders/ programmers. A few of the features of JavaScript given below:

# 1. Logical Operators

JavaScript have AND, OR, NOT operators but in new JavaScript updated three new logical operators are as follow:

## A. &&= Operator

In the new logical operator if X variable has a specific value, then the variable should be assigned the value of variable Y. That's why we use a console.use(X), now the value of the variable of X is a change from 10 to 15.Let see the example:

``````    let X = 10;
let Y = 15;
X &&= Y;
console.use(X);
// Now, the output of variable X is 15.
``````

## B. ||= Operator

This operator is the opposite of &&= operator. In this case value of variable X is not change. If variable X has the wrong value then variable X and variable Y will be equal. Let see the example:

``````let X = 10;
let Y = 15;
X &&= Y;
console.use(X);
// Now, the output of variable X is 10.
``````

## C. ??= Operator

This operator is used to check the value of the variable is NULL or not. Let see the example:

``````    let X;
let Y = 15;
X ??= 10;
console.use(X);
// Now, the output of variable X is 10.

Logic of this operator:
if(X == NULL ||  X == undefined){
X = 10
};
``````

# 2. replaceAll method using String

We all use replaceAll method using string. The new JavaScript replace method to have a limitation to change the word in a string. It changes only one word at a time.If you want to replace all words at a time you can use the regular expression. Now let see the example:

``````// with regex
let str = "Hello World!, Hello Their;"
console.log(str.replace(/Hello/g, "Hii"));
// Output will be "Hii World!, Hii Their;"

// without regex
let str = "Hello World!, Hello Their;"
console.log(str.replace('Hello', 'Hii'));
// output will be"Hii World!, Hello Their;"
``````

# 3. Using underscores for integers as a separator

Sometimes Integers are used as a data type in a string and array. It's very difficult to find out the perfect number of elements that are in million or billion.

But now in the latest JavaScript, we can easily find the number with the help of underscores(_). We can use underscores as separators in the integer. Let see the example below:

``````    let number = 1_000_000; // one million
console.log(number);
// output will be 1000000(the number will remain an integer)
``````

Some more feature as has been added in original post.