callback

a方法完成后,再执行b方法

 

function a(callback) {
for(var i=0;i<20;i++){
console.log(i);
}
callback();
}

function b() {
console.log("000");

}

function test() {
a(b);
//a(c);
}

posted @ 2017-01-23 14:37  fm060  阅读(174)  评论(0)    收藏  举报