Welcome All,

I came with new and most important tutorial named ECMAScript6 That is ES6 . It is also known as ECMA2015. We will have been seen about Es5. Es6 is the extension of es5. You know very well all about Es5 but today i will discus all about new features of Es6, So let see :-

There are many topics to discus in Es6. First we see what is the most important topics are included in Es6.

  1. Scoping
  2. Destructing
  3. Promises
  4. Arrow Function
  5. Set & map
  6. Rest Parameter
  7. Class & Modules

First of all we see how to define default value in functional parameters.

How to define default value in functional parameters.

This is already features available in es5 that is How to define default value when there will be not pass any kind of parameter by user in Functional parameter.

// For Example we have a simple function named ‘saySomething’ which contains a single parameter named ‘msg’ condition is that if any user pass the argument then o k but if he not pass any argument that how can we assign default value.

// Example of Es5

 

But in Es6 we have given to new concept to assign Default value in functional parameter. That is in Es6 How to define default value of parameter if user has not been given then case we define in-line code that put the default value then case if user pass the its own parameter value then that will be assign and display but in case User has not been assign any kind of parameters values then its own default value will be assign who has already given on the in-line argument value.

// Example of Es6

 

Scoping – Understanding of let, var and const

If we create any variable with the help of var then that variable have a function scope and we create multiple variable as a same name with the help of var That is wrong because some time we create multiple variable with same variable name with the help of var then case the last variable is overriding that value because all variable we create with the help of var is called a function scope.

For Example we create an Anonymous function and make a simple variable named x with the help of var and assign value in x = 10 and I check condition that if x is then then case we make new variable as a same name x and put the value 11 and come to the out of if block and print the value of x then What is the Output :-

// Var

 

So overcome that problem of var there will be new concept would be define named let .If we are using let keyword then it provides us block label scope that why we can get output according to the our requirement . So let we can see the same example with the help of let :-

//  let

 

Const keyword is new features of Es6. const gives us to facilitate to make variable which can not be modified

// const

 

De-structuring

This is the very good feature in Es6. It is very simple to understand and we are going to understand main features named De-structuring. If we want to retrieve an individual values from the number then case De-structuring is more important to us. let see one simple Example :-

 

Fat Arrow Function ( => )

Fat Arrow function is the most important and valuable function in Es6. It helps us to give more easier concept to making any function. let we see a simple example to explore of fat arrow function :-

 

 

 

Rest Parameter

Rest parameter is also a most important topic in Es6. We can say like The rest parameter syntax allows us to represent an indefinite number of arguments as an array. If we make Rest parameter in any function when the condition is that any user don’t know that how many parameter will be pass in the function then Rest parameter will help us because it hold any number of argument in a function parameter list. let see in the example that how to implement that Rest parameter how to work :-

 

Classes

JavaScript classes provide a much simpler and clearer syntax to create objects and deal with inheritance. Class concept is new for the Es6. It helps to more understandable and more reliable to make implementation. We have to give permission to make a constructor and function in a class level block to simplify modification and interaction in programs. Let see the example to more deeply understand of classes

Example :-

 

Thanks for reading…….