Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

settimeout in loop javascript

var array = [1, 2, 3, 4, 5]for(var i = 0; i < array.length; i++) {  setTimeout(() => {    console.log(array[i])  }, 1000);} // i = 5
Source by medium.com #
 
PREVIOUS NEXT
Tagged: #settimeout #loop #javascript
ADD COMMENT
Topic
Name
4+3 =