Show Buttons
Share On Facebook
Share On Twitter
Share On Google Plus
Share On Linkdin
Share On Reddit
Contact us
Hide Buttons

Loop over an array with the given timeout for each element


Problem

You are given an array of objects each with its name and timeout value. Iterate over each element inside an array in the interval of the given timeout.

Solution

  • We have to set timeout while iterating over an element
  • Once the timeout completes, we have to recurse over the given next item in the array
  • Increment the counter for the current element so in the recursion we can recurse over the next element

Code


You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *