DEV Community

Cover image for What is ECMAScript? What are its new features?
Kartik Malik
Kartik Malik

Posted on

What is ECMAScript? What are its new features?

According to Wikipedia, "ECMAScript (or ES) is a trademarked scripting-language specification standardized by Ecma International in ECMA-262 and ISO/IEC 16262. It was created to standardize JavaScript, so as to foster multiple independent implementations."

The committee that standardizes ECMAScript is called TC39. Its members are major browser vendors, other companies. You can read more about TC39 and how it works here.These specifications lay the foundation of the Javascript language and its evolution. It is important to note that Javascript has extra features which are not part of the specification. The good thing about the specifications is that it brings new features to the language which improves the developer experience.

The different versions of ECMAScript are named as ES# (ES1, ES2, ES3, ES5 ....) or by the year in which they were added ES2016. We also have something called as ESNext, these are the features which are not currently finalized and added to the specification. You can read more about naming and history of ECMAScript from this Wikipedia article.

New features that were released

ES5

This version released array methods.map(), .reduce(), .filter() .., along with new JSON, string, date functions. Check the full list here.

ES6

This version had a lot of useful features lets go through a few of them in detail,

  • let and const

Using these keywords now you could create block-scoped variables.
Using const you could create block scoped constants.

  • Template strings

What do you do when you want to display a message which consists of two different things? That's simple you use a + operator and concatenate them.

  'Hello there, ' + username + ' welcome to our app.'

The problem with this is ad the number of variables increases the syntax becomes too large, repetitive and difficult to read.
Template strings allow you to form a string using the back-tick character. You put the string inside back-ticks, and use ${} to insert values of a variable in the string. The above string would become this

  `Hello there, ${username} welcome to our app.`
  • Destructuring

With destructuring, you can extract certain properties from an object and create variables with their values. This reduced the amount of code you write and made it more readable.

  //before
  let name = user.name
  let age = user.age
  //now
  let { name, age } = user

Here you could extract and create variables directly.

  • Promises
    Promises made the async world a bit simpler, saving us from undefined result issue, and the callback hell.

  • Import / Export statements
    Previously you had to use module.exports to export and require() to require modules.
    Now you can export anything from a file using the export keyword and import a module to your file using the import keyword.

I have not covered all the features here as the list is quite big, you can go through this article to get to know all of them in detail.

ES7

This version brought two cool things

  • Array.includes() method.

Before this to check if an element exists in an array or not you hade to use
Array.indexOf(element), it returned -1 that means the element was not part of the array else it was. With .include() you can skip this extra check. IT will return a boolean value, true if elements exist false otherwise.

  • Exponential operator

'**' is the exponential operator. Now you don't need to use Math.pow() you can use this operator directly.

  console.log(2 ** 3)
  Output: 8

ES8

This version brought many features to Object, String types. You can read all about them here.
The feature that I loved the most was async/ await. Made async programming even simpler.

New features of 2018

The features that I liked the most were rest and spread regex capture groups. Check the full list here.

Woah that was a lot to take in, right? All of these are cool and all but,
You might be wondering how to keep track of this? You can do this simply by following some blogs, newsletters.

  1. 2ality, an awesome JS blog.
  2. JS weekly , you will get great JS articles, news that were published.
  3. Dev cominity, use the Javascript tag and you will see awesome things people have written about new features, techniques and whatnot.
  4. FreeCodeCamp publication on medium.

By following these things and being regular you will be able to level up your skills.

If you like this post, do share it. Also, check out my other posts where we have discussed a few of the above features in detail.

Top comments (0)