function a(callback){
document.writeln('functionA!<br/>');
callback('The next function is ');//传参
}
function b(str){
document.writeln(str+'functionB<br/>');
}
function c(str){
document.writeln(str+'functionC<br/>');
}
function test(){
a(b); //b为a的回调函数
a(c);
document.writeln('functionA!<br/>');
callback('The next function is ');//传参
}
function b(str){
document.writeln(str+'functionB<br/>');
}
function c(str){
document.writeln(str+'functionC<br/>');
}
function test(){
a(b); //b为a的回调函数
a(c);
}
value:
functionA!
The next function is functionB
functionA!
The next function is functionC