Valuable topics of JavaScript
- Block Bindings
Variable declarations has been one important part of programming in JavaScript. Bindings means variables. Variables are created at the spot where the declaration occurs.
2. Var declarations
Var is a JavaScript variable. When you declared a var variable then you change the value. if var variable declared outside of function that is called global variable.
3. Let declaration
The let declaration is the same as the var. You can basically replace var with let to declare a variable. When you declared a let syntax then you change the value.
4. const declarations
Const means constant. When you can used const variable then you can never change the value.you cannot be change once set.
const num=30; const num= 50; error.
Because const variable values con not be changed.
5. Block Binding in loop
Perhaps one area where developers most want block level scoping of variables is within for loops where the throwaway counter variable is meant to be used only inside the loop.
6. Comment
Comment is most important for Writing code. You can understand read a code comment you can understand this code. Comment two types Single line comment. You can be used Single line comment starting with // Multiline comment You can be used multiline comment starting with /*…*/
7. Default parameters
Default parameters to be initialized with default value.. If you can no value or result is undefined. 8. Arrow function Arrow function is shorter from function. Arrow function only one statement return a value. In arrow functions there are no binding of this.
name = () => “hi”;
9. Spread operator
Spread syntax (…) it can used all elements of array object. When you used spread syntax in any array the pass all the value of array. Spread means copy the all values in object and array.