Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

setinterval vs settimeout js

var intervalID = setInterval(alert, 1000); // Will alert every second.
// clearInterval(intervalID); // Will clear the timer.

setTimeout(alert, 1000); // Will alert once, after a second.
setInterval(function(){ 
	console.log("Oooo Yeaaa!");
}, 2000);//run this thang every 2 seconds
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #setinterval #settimeout #js
ADD COMMENT
Topic
Name
7+3 =