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

  • Home
  • SEARCH
  • 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 35393
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T14:13:44+00:00 2026-05-10T14:13:44+00:00

So, I am seeing a curious problem. If I have a function // counter

  • 0

So, I am seeing a curious problem. If I have a function

// counter wraps around to beginning eventually, omitted for clarity. var counter;  cycleCharts(chartId) {     // chartId should be undefined when called from setInterval     console.log('chartId: ' + chartId);     if(typeof chartId == 'undefined' || chartId < 0) {         next = counter++;     }     else {         next = chartId;     }     // ... do stuff to display the next chart } 

This function can be called explicitly by user action, in which case chartId is passed in as an argument, and the selected chart is shown; or it can be in autoplay mode, in which case it’s called by a setInterval which is initialized by the following:

var cycleId = setInterval(cycleCharts, 10000); 

The odd thing is, I’m actually seeing the cycleCharts() get a chartId argument even when it’s called from setInterval! The setInterval doesn’t even have any parameters to pass along to the cycleCharts function, so I’m very baffled as to why chartId is not undefined when cycleCharts is called from the setInterval.

  • 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. 2026-05-10T14:13:45+00:00Added an answer on May 10, 2026 at 2:13 pm

    setInterval is feeding cycleCharts actual timing data ( so one can work out the actual time it ran and use to produce a less stilted response, mostly practical in animation )

    you want

     var cycleId = setInterval(function(){ cycleCharts(); }, 10000);  

    ( this behavior may not be standardized, so don’t rely on it too heavily )

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

Sidebar

Ask A Question

Stats

  • Questions 87k
  • Answers 87k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Try the following Dim result = Regex.Replace(input, "(\d)\s*:\s*(\d)", "$1:$2") This… May 11, 2026 at 5:35 pm
  • Editorial Team
    Editorial Team added an answer You can use the joinTable keyword in your mapping to… May 11, 2026 at 5:35 pm
  • Editorial Team
    Editorial Team added an answer The SubSonic project has some code examples on their web… May 11, 2026 at 5:35 pm

Related Questions

I have a genealogical database (about sheep actually), that is used by breeders to
In VS .NET, when you are selecting a folder for a project, a dialog
The answer to this question may turn out to be, Don't use typed DataSets
I am working on a typical data entry system in Silverlight. Most of my

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.