Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7492489
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T16:26:59+00:00 2026-05-29T16:26:59+00:00

I have n parameters which have to be run in sequence for t seconds

  • 0

I have n parameters which have to be run in sequence for t seconds each. All the data is stored in an array which is loaded dynamically through ajax and json and exists of: function parameters p and time to sleep t

function(p1), for 30 seconds; when it completes function(p2) for 15 seconds etc etc

Until the array is complete; then we have to start all over.
The number of parameters and its time being displayed are not determined on forehand.

How can I implement this with javascript?

//edit:
I tried to make one big function with function(p1) starting at t=0; function(p2) starting at t=t1; function(p3) starting at t=t1+t3

But it felt ‘stupid’ and overdone….

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T16:27:00+00:00Added an answer on May 29, 2026 at 4:27 pm

    I suspect you array looks like

    var myarray=[['p1',30],['p2',15] ...];
    

    In this case you could

    function runme(i) {
      if (i>=myarray.length) i=0;
      var p=myarray[i][0];
      var t=myarray[i][1];
      myfunction(p);
      i=i+1;
      window.setTimeout('runme('+i+');',1000*t);
    }
    

    Edit

    And ofcourse

    runme(0);
    

    to start.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have around 8-9 parameters to pass in a function which returns an array.
I have a Stored Procedure called spGetOrders which accepts a few parameters: @startdate and
I have an executeable (Command line which requires arguments/parameters) i need to run on
I have an SQL reporting server report which has 5 parameters which permit nullable
I have a URL which requires some parameters. The values of those parameters can
I have a function which takes in two parameters, and returns one or the
I have a service class which has overloaded constructors. One constructor has 5 parameters
I have already a site with a single homepage index.php which accepts 2 parameters
You have a method on a class that has 2 parameters, one of which
I have a bunch of named value parameters in a Dictionary<string, object> , which

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.