Exploring ECMAScript (ES7, ES8, ES9, ES10) New Features

Related Articles

JavaScript has evolved significantly over the years, and with the introduction of ECMAScript (ES) standards, it has become a versatile and powerful programming language. In this blog, we will explore the new features introduced in ECMAScript versions 7, 8, 9 and 10, also known as ES7, ES8, ES9 and ES10 respectively. These updates bring many improvements, making JavaScript development more efficient and expressive. So let’s dive into the exciting world of ECMAScript and find out what these versions have to offer!

ES7 features


God includes() The method simplifies the search for array elements. It allows you to check if an array contains a particular element and returns a boolean value. This feature eliminates the need to write custom functions or use the indexOf() method to check for the existence of an element.

const numbers = [1, 2, 3, 4, 5];
console.log(numbers.includes(3));  // Output: true
console.log(numbers.includes(6));  // Output: false

Exponentiation operator (**):

The exponentiation operator ** Provides a concise way to calculate exponentiation. It replaces the Math.pow() method, which can be cumbersome to use in some cases.

console.log(2 ** 3);  // Output: 8
console.log(4 ** 0.5);  // Output: 2

ES8 features


async functions and the await Keyword to simplify asynchronous programming. They allow you to write asynchronous code that looks synchronous, making it easier to reason about and maintain. Async functions automatically wrap return values ​​in promises, and the await keyword suspends the execution of the function until the promise is resolved.

async function fetchData() {
  try {
    const response = await fetch('');
    const data = await response.json();
    return data;
  } catch (error) {
    console.error('Error:', error);

Object.values() and Object.entries():

These new object methods make iterating over object properties easier.
Object.values() Returns an array of the object’s enumerated property values, while Object.entries() Returns an array of key-value pairs.

const user = {
  name: 'John Doe',
  age: 25,
  email: '[email protected]'
console.log(Object.values(user));  // Output: ["John Doe", 25, "[email protected]"]
console.log(Object.entries(user));  // Output: [["name", "John Doe"], ["age", 25], ["email", "[email protected]"]]  

ES9 features

Asynchronous iteration:

ES9 introduced support for asynchronous iteration with the introduction of the for-await-of loop. This feature allows you to iterate over asynchronous data sources, such as promises or streams, using familiar syntax.

async function fetchUsers() {
  const userPromises = [getUser(1), getUser(2), getUser(3)];
  for await (const user of userPromises) {

Rest/apply properties:

The rest and spread syntax, previously available for arrays, is now extended to objects. You can use the three dots (...) syntax to propagate an object’s properties into another object or to collect remaining properties into a new object.

const user = { name: 'John Doe', age: 25 };
const { name, ...details } = user;
console.log(name);  // Output: "John Doe"
console.log(details);  // Output: { age: 25 }

ES10 features

Array.prototype.flat() and Array.prototype.flatMap():

These methods provide concise ways to surface nested arrays (flat()(and perform mapping operations while leveling)flatMap()).
They make it easier to work with arrays of varying depths.

const numbers = [1, [2, [3]]];
console.log(numbers.flat());  // Output: [1, 2, [3]]

const numbers = [1, 2, 3];
console.log(numbers.flatMap(x => [x * 2]));  // Output: [2, 4, 6]

Optional catch binding:

ES10 allows you to omit the catch parameter in try-catch blocks using an empty pair of parentheses catch{}. This feature is especially useful when you don’t need to use the error parameter.

  try {
    // Code that may throw an error
  } catch {
    // Handle the error without an error parameter

String.prototype.trimStart() and String.prototype.trimEnd():

These methods provide a simple way to remove leading and trailing white spaces from threads. They complement the existing trim() method, improving string manipulation abilities.

const text="   Hello, World!   ";
console.log(text.trimStart());  // Output: "Hello, World!   "
console.log(text.trimEnd());  // Output: "   Hello, World!"


The continued development of ECMAScript has made JavaScript a powerful and expressive programming language. ES7, ES8, ES9, and ES10 introduced a variety of new features and improvements, simplifying common programming tasks and improving developer productivity. As JavaScript continues to evolve, staying up-to-date on the latest ECMAScript features is essential for any JavaScript developer. So, embrace these new features and unlock the full potential of JavaScript in your projects. Happy coding!

Get more tutorials on Javascript

  • Source

    Popular Articles