In a simplified definition, we can say that when a function is declared before defining it the definition is uplifted(behind the scene) and the code is also work.
Block Binding in Loops
But, to solve this problem, block binding scope came. We can use const or let to solve this problem.
It is an area where there is nothing to do outside with inside, suppose, we defined a variable with value 3. If we print that variable outside the scope, it will show undefined.
Besides traditional function definition, ES6 has arrow function different syntax than traditional function syntax. But it has few limitation. It can not be used in all kind of situation we need.
Sometimes we need to assign with more data in another object or array. In that case, we have to iterate all element of array. So, spread operator is a solution for not iterating all and assign all data into a new one.
“try … catch”
No matter who we are, we all are never be perfect. We may mistake in some case. So as in programming, we may create a situation where the code will end up in an infinite loop which will crush the system. To avoid this we use try … catch syntax.
Function with default parameters
When we pass parameters to function, sometimes, few parameters will be missing for not availability. In this kind of situation, we may need a default value for this problem. So default parameters value might be helpful in this scenario.