How to explain callbacks in plain english? How are they different from calling one function from another function?

后端 未结 30 1534
时光说笑
时光说笑 2020-11-22 11:13

How to explain callbacks in plain English? How are they different from calling one function from another function taking some context from the calling function? How can thei

30条回答
  •  情歌与酒
    2020-11-22 11:16

    I think it's an rather easy task to explain.

    At first callback are just ordinary functions.
    And the further is, that we call this function (let's call it A) from inside another function (let's call it B).

    The magic about this is that I decide, which function should be called by the function from outside B.

    At the time I write the function B I don't know which callback function should be called. At the time I call function B I also tell this function to call function A. That is all.

提交回复
热议问题