Consider this scenario: You are loading a script (script 1) on your page which two other scripts rely on to function (scripts 2 and 3). All of these scripts can be safely executed after construction of the DOM. Which of the following approaches would work when loading these scripts? Select all that apply.

Advertisement

Here is the answer of the question: Consider this scenario: You are loading a script (script 1) on your page which two other scripts rely on to function (scripts 2 and 3). All of these scripts can be safely executed after construction of the DOM. Which of the following approaches would work when loading these scripts? Select all that apply.

  • Load all of the scripts asynchrously so they don’t block DOM construction while the browser fetches them, but make sure to include script 1 first in the HTML.
  • Load script 1 normally (without an async or defer) attribute and load scripts 2 and 3 with the defer attribute.
  • Load all 3 scripts with the defer attribute, making sure to include script 1 first in the HTML.
  • It doesn’t matter. The scripts can be executed in any order.

The above question is related to “HubSpot CMS for Developers II: Best Practices“. You can find all the updated questions and answers related to to “HubSpot CMS for Developers II: Best Practices” on the “HubSpot CMS for Developers II: Best Practices” page. If you find the update in question or answers, do comment on this page and let us know. We will update the answers as soon as possible.

Join our list

Subscribe to our mailing list and get interesting stuff and updates to your email inbox.

Thank you for subscribing.

Something went wrong.

Leave a Comment

Share via
Join our list

Subscribe to our mailing list and get interesting stuff and updates to your email inbox.

Thank you for subscribing.

Something went wrong.

Send this to a friend