function repeact(str, time, print) { return function (s) { for (let i = 0; i < time; i++) { setTimeout(() => { str(s); }, print * (i + 1)); } }; } const repeatFunc = repeact(console.log, 4, 3000); repeatFunc("helloword");