what is the difference between settimeout and setinterval code example
Example 1: difference between setTimeout() and setInterval()
.setTimeout()
.setInterval()
Example 2: setinterval vs settimeout js
var intervalID = setInterval(alert, 1000);
setTimeout(alert, 1000);
setInterval(function(){
console.log("Oooo Yeaaa!");
}, 2000);
Example 3: setinterval vs settimeout
setTimeout allows us to run a function once after the interval of time.
setInterval allows us to run a function repeatedly, starting after the interval of time, then repeating continuously at that interval.