JS
1. function test() {
return ();
}
or
const test = function() {
return();
}
or
const test =() =>{
return();
}
--Arrow function
2. var is for creating new variable, but its outdated syntax
3. let and const are some next gen js
use const when you don't want to change the variable
"let is same as a var"
4. you can also add function in the js object
5. map function loop through the array and create new array - it's like for loop of javascript
6. .push is same as .append in python for adding element in array
7. array and object are primitive data type so const value can change, means we do change array and object value later after assiening them with const also
8. Rest and Spread Operator
- Spread Operator
basically it pull out the items from the array and objects and put it into another object
- in Rest operator, syntax is same as spread operator -
it's like a kwargs in python, which we are using in spread operator, it takes multiple input and return an array
9. We can destruct array and object both, destructring means pulling out the item by their property name without writing the object and array name
10. Async code and promises
- it does not run immediateely
then /catch is of es6
async/await is of es7
11. We can transfer the data from one component to another with the help of props
12. if we have to do the child to parent props passsing, what we can do is we pass the function from parent to child which go in the child and do the same thing
13. when there is a lots of state update, try to put the setState method in the function, because setstate is schdeuled but if put this operation inside the function it will guarnteed our set our state successfull
Comments
Post a Comment