newbie approach: what is a javascript callback function?

前端 未结 7 2157
自闭症患者
自闭症患者 2020-11-28 12:49

Is just a function that executes after one other function that calls it, finishes?

Please I know (almost) nothing about programming, and I find it quite hard to find

7条回答
  •  执念已碎
    2020-11-28 13:38

    A callback is simply a function you specify that is called not immediately but usually after some event. This could be something like an ajax request, you would specify a callback that is invoked only when the ajax request is successfully completed and doesn't error out. Another example would be a callback for when the DOM in a web page is ready, or the window loads.

提交回复
热议问题