js 回调函数

A callback is a function that is passed as an argument to another function and is executed after its parent function has completed.

example:

function a(callback){
    alert('parent function.');
    callback();
}

function b(){
    alert('callback function.');
}

execute  a(b)

result:
parent function.
callback function.


如何传参数?
(后面续)

你可能感兴趣的:(js 回调函数)