标签:promise roc gen enum str lan 异步操作 ajax console
function step1(func){
process.nextTick(function(){
console.log(‘step1‘);
func(1);
});
}
function step2(val, func){
process.nextTick(function(){
console.log(‘step2,‘ + val);
func(val+1);
});
}
function step3(val, func){
process.nextTick(function(){
console.log(‘step3,‘ + val);
func(val+1);
});
}
function step4(val, func){
process.nextTick(function(){
console.log(‘step4,‘ + val);
func(val+1);
});
}
step1(function(val1){
step2(val1, function(val2){
step3(val2, function(val3){
step4(val3, function(val4){
console.log(‘val4, ‘, val4);
})
})
})
})
标签:promise roc gen enum str lan 异步操作 ajax console
原文地址:http://www.cnblogs.com/strinkbug/p/6713354.html