1. Default parameters:
Before ES6 we had to do these statements to define default parameters:

They were okay until the value was 0 and because 0 is false in JavaScript it would default to the hard-coded value instead of becoming the value itself. Of course, who needs 0 as a value .so we just ignored this flaw and used the logical OR. we can put the default values right in the signature of the functions:
2. Template Literals
Template Literals or interpolation is a way to output variables in the string.
Template Literals or interpolation is a way to output variables in the string.
In ES6, we can use new syntax ${Name} in the back ticked string.
E.g.:
var name = `Your name is ${first} ${last}.`
var name = `Your name is ${first} ${last}.`
var url = `http://localhost:3000/api/messages/${id}`
3.
Multiline Strings
In ES5, to declare a string in multiple lines we had to use one of the below two approaches:
Multiline StringsIn ES5, to declare a string in multiple lines we had to use one of the below two approaches:
While in ES6, simply utilize the backticks:
var roadPoem = `Then took the other, as just as fair,
And having perhaps the better claim
Because it was grassy and wanted wear,
Though as for that the passing there
Had worn them really about the same,`
var fourAgreements = `You have the right to be you.
You can only be you when you do your best.`
4. De-structuring assignment
var data = $('body').data(), // data has properties house and mouse
house = data.house,
mouse = data.mouse
Other examples of destructuring assignments (from Node.js):
var jsonMiddleware = require('body-parser').json
var body = req.body, // body has username and password
username = body.username,
password = body.password
In ES6, we can replace the ES5 code above with these statements:
var {house, mouse} = $('body').data() // we'll get house and mouse variables
var {json: jsonMiddleware} = require('body-parser')
var {username, password} = req.body
This also works with arrays. Crazy!
var [col1, col2] = $('.column'),
[line1, line2, line3, , line5] = file.split('\n')
5. Enhanced Object Literal
In ES5
In ES6
6. Arrow functions
Using arrows functions in ES6 allows us to stop using that = this or self = this or _this = this or .bind(this). For example, this code in ES5 is ugly:

This is the ES6 code without _this = this:

7. Promises
There were a lot of promise implementations with slightly different syntax. q, bluebird, deferred.js, vow, avow, jquery deferred to name just a few. Others said we don’t need promises and can just use async, generators, callbacks, etc. Gladly, there’s a standard Promise implementation in ES6 now!
Let’s consider a rather trivial example of a delayed asynchronous execution with setTimeout():

We can re-write the code in ES6 with Promise:

8. Block scoped construct let and const
9.
Classes
Classes
10.Modules: Native Module support
As you might now, there were no native modules support in JavaScript before ES6. People came up with AMD, RequireJS, CommonJS and other workarounds. Now there are modules with import and export operands.