如果已经有三个promise,A、B和C,想串行执行,该怎么写?
function one(){
console.log(11111);
}
function two(){
console.log(22222);
}
function three(){
console.log(33333);
}
function fiveP(func){
return new Promise(function(resolve, reject) {
func();
resolve();
});
}
p.then(fiveP(one)) /* 11111 */
.then(fiveP(three)) /* 33333 */
.then(fiveP(two)) /* 22222 */
.then(function(result) {
console.log('Got value: 最后执行' + result); // Got value:最后执行
});