SOURCE

function todolist(callbackList, timeout) {
    callbackList.reduce((promise, callback) => {
        return new Promise((resolve) => {
            promise.then(() => {
                callback();
                setTimeout(resolve, timeout);
            })
        });
    }, Promise.resolve())
}

todolist([
    () => console.log(1, +new Date().getSeconds()),
    () => console.log(2, +new Date().getSeconds()),
    () => console.log(3, +new Date().getSeconds()),
], 2000);
console 命令行工具 X clear

                    
>
console