1. Default Parameters in ES6
In ES6 function can have a default parameter. When a function is called and demands some parameter if we do not give the demanded parameter it will give the output NaN. In ES6 we can give a default parameter so if any of the values of the parameters is not give in the function call it will give the output for the default parameter.
2. Template Literals in ES6
Template literal is a way to create a string. It's a greater way to write dynamic strings whereas previously we were using concat() method to create a dynamic string.
3. Multi-line Strings in ES6
Back then we needed to use concat() method and newline character /n for writing multiline string but in ES6 we simply utilize this with a backtick.
4. Destructuring Assignment in ES6
5. Proper tail-calls
A function is called tail recursive if the recursive call occurs in the portion of any function. These tail recursive functions perform better than any other recursive functions. The improved tail recursive call doesn’t make another stack outline for each function call, yet rather utilizes a solitary stack outline.ES6 brings the tail-call optimization in severe mode.
6. Classes in ES6
Previously there was no keyword class to create a class in ES5 for that it was a complex procedure to construct a class and use it. But in ES6 it is easier to work with the class. It uses prototypes, not the function factory method.
It is possible to inherit data of class to another class by inheritance in ES6. All instances of any particular class can be accessed by another class easily.
In this example, all properties of Service class are inherited to SpecialService class.
8. Arrow Functions in ES6
9. Block-Scoped Constructs Let and Const
ES6 introduces two new variable declaration methods let and const. They are pretty similar but the difference is in the scope. Variables that declared by let can be changed or modified later but variables that declared with const are constant or fixed values that can not be changed.
10. Modules in ES6