Member-only story
ES11 / ECMAScript2020
6. A Deep Dive into the Latest JavaScript Features — ES11
The JavaScript has been evolved a lot and one of the widely used language in the world. We are discussing about some core feature of ES11 / ECMAScript 2020 / ECMA2020, the iteration of the ECMAScript standard. Let’s talk about exciting features that can streamline your workflow and enhance your code.
In this article, we’ll delve into some of the key features introduced in ES11:
1. Private Class Variables
We can use private variables inside class using #
class Person {
#name = 'JS';
getName() {
return this.#name;
}
}
const person = new Person();
console.log(person.getName()); // JS
console.log(person.#name); // throws error2. Static Fields
class Person {
static name = 'JS';
getName() {
return Person.name;
}
}
const person = new Person();
console.log(person.getName()); // JS
console.log(Person.name); // JS3. Promise.allSettled
It is used to handle multiple promises concurrently.
Unlike Promise.all, which rejects immediately if any promise in the array rejects.









