ES6 and other features of JS

2.Try and catch :Bugs and errors are unavoidable in programming .It will happen .To handle this we need to try and catch . The main code put inside the try block . If code got any error it will not be executed and catch block will be executed . If code has no error it be executed in try block and catch block will be skipped.

3.Throw : Throw statement is used to create a custom error .It helps to generate user defined custom error.

4.Finally : Finally statement will be always executed , no matter code got bugs or not .

5.Function with default parameters :In java script default function parameters allowed named parameters to be initialized with default value if parameter value is missing . So it’s better to pass default value .

6.Arrow function : ES6 introduced arrow function which allow us to declare function in cleaner and shorter way as compare to regular function.

7.Spead operator : It is a feature of ES6 , which allow to spread or expand an iterable and array .

8.Block level function : This function is the feature of ES6 . Function only will access inside the block means in the curly braces ‘{}’.Outside block can not be used .

9.Block-level-declaration : Block-level-declaration is declare variable or function inside a block {}, can not be access from outside of block . var keyword can not be block level declaration.

10.Block binding in loop :

In for loop if variable declared with var keyword ,we can access it from outside of the loop .To solve this problem we can use let or const keyword.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store