SOURCE

const arr = [1, 2, 3, 4];
let promise = val => {
    return new Promise((resolve, reject) => {
        setTimeout(() => {
            console.log(val);
            resolve();
        }, 1000)
    })
};
arr.reduce((p, val) => {
    return p.then(() => {
        return promise(val);
    });
}, Promise.resolve());
console 命令行工具 X clear

                    
>
console