What is setTimeout versus setInterval?
The JavaScript function setTimeout and setInterval performs an action after a specified time period. The difference between setTimeout and setInterval is that setTimeout performs an action only once once after the specifed time period ellapses, and setInterval keeps repeating the action. The actions started by setTimeout and setInterval can be stopped by using the methods clearTimeout and clearInterval respectively.