SOURCE

function repeat(func, times, wait){
	return function(arg){
		var count = 1;
		var intervalId = setInterval(function(){
			func(arg);
			count === times ? clearInterval(intervalId) : count++;
		}, wait);
	}
}
const repeatFunc = repeat(alert, 4, 3000);
repeatFunc('hello')
console 命令行工具 X clear

                    
>
console