3/19/2024 0 Comments Import minified js file es6![]() ![]() The regular script runs immediately, so we see its output first. That’s because modules are deferred, so we wait for the document to be processed. Please note: the second script actually runs before the first! So we’ll see undefined first, and then object. regular scripts run immediately, before the rest of the page is processed ![]() ![]() as modules are deferred, the script runs after the whole page is loadedĪlert(typeof button) // button is undefined, the script can't see elements below relative order of scripts is maintained: scripts that go first in the document, execute first.Īs a side effect, module scripts always “see” the fully loaded HTML-page, including HTML elements below them.Īlert(typeof button) // object: the script can 'see' the button below.module scripts wait until the HTML document is fully ready (even if they are tiny and load faster than HTML), and then run. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |