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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T02:40:36+00:00 2026-05-23T02:40:36+00:00

it maybe called after ‘some’ normal code is executed? but i not sure… it

  • 0

it maybe called after ‘some’ normal code is executed? but i not sure…
it would be great if some one kind enough to depict a big picture of how javascript code is executed in a browser.

  • 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-23T02:40:37+00:00Added an answer on May 23, 2026 at 2:40 am

    For most of the time the browser execution thread is idle, not running any code. When you register some function to be executed using setTimeout, it will be executed not earlier than after given amount of milliseconds.

    Now: if after given amount of time some other code is executing (like event handler or a long loop), browser worker thread is busy and your function will have to wait. Consider this code:

    setTimeout(f, 500);
    for(var i = 0; i < 10000000; ++i){
        //...
    }
    

    setTimeout returns immediately allowing the execution of the loop. If this loop runs for more than 500 milliseconds, it won’t be interrupted and your f function will have to wait. The same thing will occur if after e.g. 490 milliseconds you trigger some lengthy event handler.

    Consider browser JS worker thread as a queue with a single consumer and multiple producers. Some items in the queue can be picked up immediately (like event handlers), some have to wait until their timeout expires.

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

Sidebar

Related Questions

Maybe world peace would be easier, but I have a problem with the widths
I want code in a php5 page be executed after all of the page
After the last two comments, I'll dump out my real code and maybe it
Maybe I'm not understanding something basic here, but the html() call doesn't return an
Maybe I'm being misled by my profiler (Netbeans), but I'm seeing some odd behavior,
Maybe I just don't know .NET well enough yet, but I have yet to
Maybe the need to do this is a 'design smell' but thinking about another
Maybe this is a dumb question, but is there any way to convert a
Maybe I'm just thinking about this too hard, but I'm having a problem figuring
Maybe my understanding of agile development isn't as good as it should be, but

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.