repeat那道题,我也给一个思路,大家可以参考 function* inner(func, text, times) { for (let i = 0; i < times; i ++) { yield func(text) } } function repeat2(func, times, interval) { return function (text){ let innerFunc = inner(func, text, times) let inter = setInterval(() => { let res = innerFunc.next() if (res.done) { clearInterval(inter) } }, interval) } }