Let's See some difference between var, let and const :
Var: The scope of a var variable is functional scope.It can be updated and re-declared into the scope.It can be declared without initialization.It can be accessed without initialization as its default value is “undefined”.
Let: The scope of a let variable is block scope.It can be updated but cannot be re-declared into the scope.It can be declared without initialization.It cannot be accessed without initialization otherwise it will give 'referenceError'.
Const: The scope of a const variable is block scope.It cannot be updated or re-declared into the scope.It cannot be declared without initialization.It cannot be accessed without initialization, as it cannot be declared without initialization.
Regular Function:
1. In a regular function, there is an arguments local variable. If the
number of arguments to our function is dynamic, using arguments allows us to easily do things
like calculating the maximum number of passed arguments.
2. In non-restrict mode, regular functions allow us to use duplicate named parameters. But in
strict mode, it is not allowed.
3. In a regular function, its internal this value is dynamic, it depends on how the function is
invoked.
Arrow function:
1. In the arrow function, there are no arguments, if we access arguments in the arrow function
will return the arguments of the closest non-arrow parent function.
2. In arrow functions, parameters with the same name are not allowed whether the strict mode is
enabled or not.
3. In the arrow function, there are no this, if we access this in the arrow function it will
return the this of the closest non-arrow parent function.
Map: When we want to transform elements in an array we can use .map().
ForEach: When we need to execute a function for each individual element in an array .forEach() is great option.
Filter: When we want to select a subset of multiple elements from an array we cam use .filter().
Find:When we want to select a single element from an array we can use .find().