function repeat(func,times,wait){ let t = null; let m = 0; return function(values){ t=setInterval(()=>{ m++; if(m>times){ clearInterval(t); }else{ func(values) } },wait) } //补全 } const repeatFunc = repeat(console.log,4,3000); repeatFunc("hello world") //输出4次hello worlod,每次间隔3秒