Var, Let, and Const – What's the Difference?
Let
if let used in a function it cannot be accessed outside of that function. if let is used outside the function that means it can be accessed in the global scope also in the function scope
Var
it can be accessed from anywhere whether its decleared inside the function scope or glogal scope
Const
It’s quite similar to Let with the only difference that once the variable has been defined then its value cannot be changed. Like if the user tries to change the value of the const variable, then they will get an error.
if let used in a function it cannot be accessed outside of that function. if let is used outside the function that means it can be accessed in the global scope also in the function scope
Var
it can be accessed from anywhere whether its decleared inside the function scope or glogal scope
Const
It’s quite similar to Let with the only difference that once the variable has been defined then its value cannot be changed. Like if the user tries to change the value of the const variable, then they will get an error.
The Difference Between Regular Functions and Arrow Functions
Arrow function is sorter and simpler then regular function. arrow function can be written in single line. also arrow function do not bind this keyword. that means unlike regular function this keyword has no effect in arrow function this inside arrow function reffer to the glogal objects.
Why You Use Templete String
The first reason the use String Templete is to is so easiar to concate a string and a variable. we do not have to use '+' sign to concate a string and a variable. Another great benefit of using templete string is it allows to use multiline code it comes handy when we need to add multiple html tag in DOM.