Template Literals can be used anywhere, where strings are used. It uses backticks (`) instead of ugly single and double quotes. Let’s talk about the benefits of this:
Multi-Line Display: We can also use
enter/return when typing template literal, it will then cause the string to be displayed on multiple lines!
The default assignment statement, only occurs if no arguement is passed into the function.
We just need to make sure, we always set the default value at the end of the parameter list, otherwise it may give
It’s more shorter and concise way of representing functions. It just replaces the
() => Syntax will be :
✨ Shorthand : When an arrow function has just a single parameter, then we can ignore parenthesis
✨ Most Important
'this' Borrower Arrow Expressions do not have their own
this value. This doesn’t mean that we can’t use them, We can but the value of
this will be the surroundings of arrow function.
Before Arrow Functions, We need to bind
this, in order to access
It’s working because we are no longer allowing the default
this value. Instead, we are manually setting it to
this at this moment in time.
After Arrow Functions Came, It’s more concised now 🎉
It basically sends all the values of an
array into a function as arguments, using the spread operator
✨ Important : We can also spread the characters of an string into an array
It gives us the power to, take out the elements which are required from a larger piece of structured data. It can be only performed on
objects. When we do array destructuring, then it will be based on
position and with objects, it will be based on