// 每3秒打印一个helloworld,总计执行4次
function repeat(fn, times, timeout) {
return function(content){
var count=0
var interval = setInterval(function(){
count+=1
fn(content)
if(count==times){
clearInterval(interval)
}
},timeout)
}
}
const repeatFunc = repeat(console.log, 4, 1000);
repeatFunc("helloworld");