SOURCE

function runPromises(promiseCreators, initData) {
    return promiseCreators
        .reduce((promise, next) => promise
                .then((data) => next(data))
            , Promise.resolve(initData));
}

var promise1 = function (data = 0) {
    return new Promise(resolve => {
        resolve(data + 1);
    });
}
var promise2 = function (data) {
    return new Promise(resolve => {
        resolve(data *2);
    });
}

runPromises([promise1, promise2], 1).then(res=>console.log(res));
runPromises([promise2, promise1], 1).then(res=>console.log(res));
console 命令行工具 X clear

                    
>
console