What is a callback function?

前端 未结 21 2437
耶瑟儿~
耶瑟儿~ 2020-11-21 23:01

What is a callback function?

21条回答
  •  情话喂你
    2020-11-21 23:42

    A callback function is one that should be called when a certain condition is met. Instead of being called immediately, the callback function is called at a certain point in the future.

    Typically it is used when a task is being started that will finish asynchronously (ie will finish some time after the calling function has returned).

    For example, a function to request a webpage might require its caller to provide a callback function that will be called when the webpage has finished downloading.

提交回复
热议问题