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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T02:52:18+00:00 2026-05-19T02:52:18+00:00

I have read that it is not recommended to instantiate jQuery multiple times in

  • 0

I have read that it is not recommended to instantiate jQuery multiple times in your HTML. This makes perfect sense to me, but:
Isn’t Javascript single-threaded anyway? And leaving jQuery behind, how does the browser execute these multiple script tags? In parallel or one after another?

Thanks, Philip

  • 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-19T02:52:18+00:00Added an answer on May 19, 2026 at 2:52 am

    Simple answer:

    In a simple scenario (tags are part of original HTML text), the browser definitely executes them one after another.

    Detailed discussion with different caveats

    JavaScript isn’t necessarily single-threaded (it depends on the implementation of your JavaScript engine, e.g. see Web Workers).

    BUT, the individual <script> tags are executed sequentially.

    For reference, please see JavaScript: The Definitive Guide. Quoting Chapter “12.3. Execution of JavaScript Programs”:

    JavaScript statements that appear between and tags are executed in order of appearance; when more than one script appears in a file, the scripts are executed in the order in which they appear. If a script calls document.write( ), any text passed to that method is inserted into the document immediately after the closing tag and is parsed by the HTML parser when the script finishes running. The same rules apply to scripts included from separate files with the src attribute.


    Please note that the above is only true of “straight up” execution of code in tags. The order can, however, be affected by:

    • setTimeout() calls (duh)

    • defer attribute

    • Dynamic attachement of the <script> tags – see the last section of this answer.


    As a caveat, please note that JavaScript code loaded externally via <script src="xxxx" /> would still be executed sequentially, BUT, it is quite possible that the browser would DOWNLOAD the code in parallel – depends on browser implementation (but still schedule the execution of downloaded code snippets in correct order).

    This caveat is important in case you want to have some weird hack whereas the URL for the JavaScript source is actually a CGI script which does something and you try to depend on the correct order of downloads for the logic in the script.

    Again, it would have no bearing on your browser JS engine’s execution order of those script pieces.


    However, a far more important caveat is that if you actually attach the <script> tags with external sources dynamically (e.g. via appendChild() call), according to this SO post, as well as the MSDN blog the post was based on, non-IE browsers do NOT guarantee the order of execution! It will depend on which tag’s code finished downloading first!

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

Sidebar

Related Questions

I have read that viewstate is not there in asp.net MVC application. I am
I have read that ajax fileupload is not possible. But I want to upload
I have read that money_format is not available on windows, and on some Linux
I have read in many places that WPF combo does not support autocomplete but
I have read in a lot of places that assembly language is not usually
I have read that you should keep the number of connections in your database
I have read that for enabling the auto return I have to enable this
I have read that you can do it, but would this really improve performance
I have been pondering why it is recommended that we should not release managed
First, I must say that I have read several post about this at StackOverflow

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.