Queue 的那一题我是这么写的,不过没有用promise,不知道是不是必须要用。 class Queue { constructor () { this.queue = []; this.timer; } next () { if (this.queue.length) { let curr_fn = this.queue.shift(); this.timer = curr_fn(); } } start () { this.next(); } stop () { if (this.timer) { clearTimeout(this.timer); } } task (time, fn) { this.queue.push(() => { let timer = setTimeout(() => { fn(); this.next(); }, time); return timer; }); return this; } }