Quiz Question 1 of 6
What is the main difference between the async
and defer
attributes when used in a <script>
tag in terms of their effect on page rendering and JavaScript execution?
Choose the correct answer below:
-
A
async
allows script execution before the page finishes loading, whiledefer
prevents the script from downloading until the HTML parsing is completed. -
B
async
downloads the script without blocking page rendering and executes it immediately after downloading, whiledefer
downloads the script and executes it only after the HTML parsing is complete. -
C
async
anddefer
both delay script execution until the entire page is fully loaded. -
D
defer
downloads the script immediately and executes it before HTML parsing begins, whileasync
delays both downloading and execution until the end of HTML parsing.