0
What is diffrent's between setTimeout & setInterval ?
What is diffrent's between setTimeout & setInterval ?
2 Antworten
+ 3
In simple term,
setTimeout() will execute script only once after x milliseconds.
eg)setTimeout(function(){ alert("Hello"); }, 3000);//after 3 sec
setInterval() will execute script after every x milliseconds
eg)setInterval(function(){ alert("Hello"); }, 3000);//after every 3 sec
+ 1
setTimeout - calls a function once, setInterval - calls a function many times