I asked a question about callbacks and arrived at another question (see comment). How is a closure different from a callback?
相关问题
- Is there a limit to how many levels you can nest i
- How to toggle on Order in ReactJS
- void before promise syntax
- Keeping track of variable instances
- Can php detect if javascript is on or not?
What is a callback function?
A callback function is a function which is:
in Plain English we say A callback is any function that is called by another function, which takes the first function as a parameter or function passed as an argument
It is also common to say "call upon a function", "start a function", or "execute a function".
In simple words: a callback using context variables is a closure.
closure :
A function keyword inside another function, you are creating a closure
Or A function return to an other function we can say closure
Note Plain English : A little bit difference function passing as argument in another function is callback or if define in another function is closure