Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

settimeout JS for loop

window.purls = [11213,23121,43343,5644,77535]
i = 0;
for (i = 0; i < window.purls.length; i++){
    doSetTimeout(i);
}

function doSetTimeout(i) {
	setTimeout(function() {
		// Code goes here
	}, i*1200); //1200 = time in milliseconds
}
Source by learn.coderslang.com #
 
PREVIOUS NEXT
Tagged: #settimeout #JS #loop
ADD COMMENT
Topic
Name
6+7 =