1.Difference between let, const ,var
let | const | var |
---|---|---|
let allows you to declare variables that are limited to the scope of a block statement, or expression on which it is used, unlike the var keyword, which declares a variable globally, or locally to an entire function regardless of block scope. | Constants are block-scoped, much like variables declared using the let keyword. The value of a constant can't be changed through reassignment (i.e. by using the assignment operator), and it can't be redeclared (i.e. through a variable declaration). | Var is the keyword that tells JavaScript you're declaring a variable. x is the name of that variable. = is the operator that tells JavaScript a value is coming up next. 100 is the value for the variable to store. |
2.Difference between regular and arrow function
Arrow function | Regular function |
---|---|
Regular functions created using function declarations or expressions are constructible and callable. Since regular functions are constructible, they can be called using the new keyword. | arrow functions are only callable and not constructible, i.e arrow functions can never be used as constructor functions. |
In Regular functions ,a developer have to write many lines to accomplish the result | Arrow functions allow a developer to accomplish the same result with fewer lines of code and approximately half the typing. |
3.Uses of template string
1.Template strings are a powerful feature of modern JavaScript
released in ES6.
2.It lets us insert/interpolate variables and expressions into
strings without needing to concatenate like in older versions of
JavaScript.
3. It allows us to create strings that are complex and contain
dynamic elements.