What is a callback function?

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

What is a callback function?

21条回答
  •  天命终不由人
    2020-11-21 23:39

    A callback function, also known as a higher-order function, is a function that is passed to another function as a parameter, and the callback function is called (or executed) inside the parent function.

    $("#button_1").click(function() {
      alert("button 1 Clicked");
    });
    

    Here we have pass a function as a parameter to the click method. And the click method will call (or execute) the callback function we passed to it.

提交回复
热议问题