Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to set a timeout on an array element

var ary = ['kevin', 'mike', 'sally'];

for(let i = 1; i <= ary.length; i++){
    setTimeout(function(){
        console.log(ary[i - 1]);
      }, 5000 * i); 
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #set #timeout #array #element
ADD COMMENT
Topic
Name
1+4 =