Top 11 new features of ES6


ES6 (ECMA Script 6) or ECMA 2015 is the latest version of JavaScript released in June, 2015. ES6 is having lots of cool new features which we are going to explore in the upcoming sessions. Lot of popular JavaScript frameworks such as Angular 2 and React JS are started using the ES 6 features.

Currently not all the browsers are supporting ES 6, So we need transpilers to convert ES6 features to ES5 code. Traceur and Babel both are popular ES6 transpilers which will convert ES6 features into a ES5 JavaScript code.

Here is the list of top 11 ES6 features:

Constants

Constants are not changable, if you are coming from other programming languages such as C, C++ and PHP you may be aware of how to use constants. ES 6 support constants using the “const” keyword.

Block level scope

The new ES6 introduced a new feature called block level scope, using this feature a variable or function can have a scope limited to a block.

Arrow function

Arrow functions are short in syntax and this is one of the most used feature in ES6.

Default parameters

ES6 started supporting the default parameters for functions and class methods. So, we can pass the default value as part of the parameters.

Rest/Spread operators

This is one of the new coole feature in ES6 which will help to convert Array to primitive data and primitive data into an Array.

Destructuring

Destructuring helps to convert objects and array elememnts into individual variables.

Classes

Unlike ES5, ES6 started supporting “class” based object oriented programming like other programming languages such as PHP and Java.

Generators

Generators are special types of function, can be paused and resumed.

Map

The new Map object can be used to store and retrieve key value pairs.

Promises

The new Promise object is very useful to make asynchronous calls.

Template literals

Template literals allows developers to use embedded variables and expressions inside.

Tags:

You may also like