Sweetness of ES6

ES6 is the new Javascript standard. We are going to learn and practice the ES6 features that are going to be useful while creating React applications.

What is ES6?

ES6 (ECMASCript 2015) is the new Javascript standard that introduces new features in Javascript. Most of the features are syntactic sugars and are semantically equivalent to the strict mode in ES5.

However, these new features make the code concise and less error prone.

We’ll be using ES6 wherever possible. While this is a not a lesson that covers all aspects of ES6, I am going to cover many. In subsequent lessons, we would use them while learning React (and believe me when I say that React is much more fun to understand and work with when you harness the power of ES6).

Needless to say that if you are already familiar with ES6, this might seem redundant to you.

Browsers might not support ES6 directly (though browser support is increasing every week). To get around this, we need a transpiler that converts ES6 code to ES5 code. For now, ignore this and we’ll revisit this in our first lesson about React.

We are going to cover following features introduced by ES6.

  • let
  • const
  • Arrow function
  • Destructuring assignment
  • Spread operator

Let’s look at each one of these in detail.