If we created a function and we need a const variable inside the
function, which means we want a variable that will not be updated in
any case. Here if we will declare a var variable or let variable,
then it can be updated, but if we declare a const variable, it will
not be updated in any case and will work fine with our function.
We can declare var x = 50; Later we can assign another value by
written var x = 23;
We can declare let x = 50; Later we can assign another value by
written x = 23;
We can declare const x = 50; In this case we won't be able to update
the value;
Unlike regular functions, arrow functions do not have their own this . The value of this inside an arrow function remains the same throughout the lifecycle of the function and is always bound to the value of this in the closest non-arrow parent function.
Arrow Fuction is declared as cosnt function_name = (parameter) =>
{code}
where regular function is written as function
function_name(parameter){code}.
.map() executes the same code on every element in an array and returns a new array with the updated elements.
.forEach(), is used to execute the same code on every element in an array but does not change the array and it returns undefined.
.filter() checks every element in an array to see if it meets a certain criteria and returns a new array with the elements that return truthy for the criteria.
.find() method returns the first element in the provided array that satisfies the provided testing function. If no values satisfy the testing function, undefined is returned.
Template string makes things so much simpler. only one pair of
quotes, embedded variables and expressions multiple lines within the
quotes treated like strings so can be assigned or be a return value
Template literals can use the placeholders for string substitution.
To embed expressions with normal strings, we have to use the ${}
syntax.
It is easiar and simple.