← Back to list

Top 3 new JavaScript(ES13) features

New features in JavaScript are always rolling out constantly. Today, we will list down the top 5 features rolled out in ES13 also known as…

Aswin Ebpearls · 2023-08-04 06:41 · 0 claps · 0.9 min read
#javascript #es13 #ecmascript2022 #tips-and-tricks
Open on Medium ↗
Wiki topics: 🌐 · Web Development

Top 3 new JavaScript(ES13) features

New features in JavaScript are always rolling out constantly. Today, we will list down the top 5 features rolled out in ES13 also known as ES2022.

1. at() Method for Indexing

You can now directly access the elements of an array from the end without having to use length property.

const arr = ['a', 'b', 'c', 'd'];

// 1st element from the end
console.log(arr.at(-1)); // d

// 2nd element from the end
console.log(arr.at(-2)); // c

2. await Operator at the Top Level

We could only use await operators inside async function, which is not the case anymore. We can use await in the global scope now without having to wrap it inside the async function.

 function sleep(timeInMilliSec){
  return new Promise((resolve) => {
    setTimeout(() => {
      resolve();
    }, timeInMilliSec);
  });
}

await sleep(5000) //does not throw any error even without using async

3. Private methods and fields

We can now declare methods and fields as private using # in front of the variable name.

class Employee {
  name = ""
  #salary = 0
  constructor(name, salary){
      this.name = name;
      this.#salary = salary;
    }
}

let employee1 = new Employee("Foo Bar", 50000);
console.log(employee1.name) // "Foo Bar"
console.log(employee1.salary) // Undefined

There are the most promising features in the ES13 in my opinion and will be used mostly in the day to day basis. Please feel free to share if you think there are other features which are most likely to be used regularly.

Thank You!


메타데이터
post_id
c1fa44ca3923
slug
top-3-new-javascript-es13-features-c1fa44ca3923
url
https://medium.com/@aswin.ebpearls/top-3-new-javascript-es13-features-c1fa44ca3923
canonical_url
https://medium.com/@aswin.ebpearls/top-3-new-javascript-es13-features-c1fa44ca3923
author_url
https://medium.com/@aswin.ebpearls
status
ok
fetched_at
2026-07-25 10:23:07