setInterval()

setInterval() is used to repeat the execution of your code block at specified intervals.
setInterval(callback, milisecond);
basically two parameters need to run this function.

var number=1;
function incrementNumber(number){
	
	console.log(number)
}

setInterval(()=>{
	incrementNumber(number++);
},1000)
Output:- 1
2
3

Note:-It will run continuously while you close this.