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 7441863
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T11:05:06+00:00 2026-05-29T11:05:06+00:00

By oddities, I mean these two things: Functions in the first parameter need to

  • 0

By oddities, I mean these two things:

  1. Functions in the first parameter need to be surrounded by
    quotations, or else the delay is set to 0 (Everything is executed
    instantly).
  2. Everything after the timeout needs to have a delay after it as
    well, or else it is executed prior to the timeout finishing.

If there’s a way around #2 – that would be awesome, but right now I’m just curious on this.

Short snippet to explain what I’m talking about:

for (var i=0; i<10; i++) setTimeout("addInput('.')",i*500);
setTimeout('addInput("</br>")',5100);

In the above, unless addInput(‘.’) is surrounded by quotations, the delay is ignored and the code is just executed; also unless I add a timeout to the second line, it will be executed before the first timeout is finished.

  • 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-29T11:05:07+00:00Added an answer on May 29, 2026 at 11:05 am

    Functions in the first parameter need to be surrounded by quotations,
    or else the delay is set to 0 (Everything is executed instantly).

    Not necessarily. In fact it is recommended to use the overload which takes directly a function pointer instead of a string to avoid the overhead of parsing it:

    for (var i=0; i<10; i++) {
        setTimeout(function() {
            addInput('.');
        }, i * 500);
    }
    

    or its equivalent (warning: doesn’t work in IE):

    for (var i=0; i<10; i++) {
        setTimeout(addInput, i * 500, '.');
    }
    

    The following setTimeout overload is the one that is most commonly used:

    var timeoutID = window.setTimeout(func, delay, [param1, param2, ...]);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having performance oddities with Java2D. I know of the sun.java2d.opengl VM parameter to
I've noticed at least the following oddities around rubygems on Debian (5.0 lenny in
I've seen this pretty funny screencast yesterday about some oddities in languages like Ruby
A friend of mine said that they experienced oddities with using the decimal column
I'm trying to put two buttons inside a panel using Swing widgets. Inside the
Im using ScriptSharp to create a RIA app. Works nice besides some oddities. However
I wrote a script to read the Netflix catalog and populate my DB. Everything
I often need to develop stuff on the road, with no internet/network connection. I
I'm doing some pretty unholy things with JavaScript, and I've run into a weird
I have cobbled together a form due to some oddities in my code and

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.