Q
What is the difference between and ?
-
A
async preserves the order; defer does not
-
B
They are identical
-
C
defer runs scripts in document order after the HTML is parsed; async runs each script as soon as it downloads, in any order
-
D
defer blocks parsing
Correct Answer:
C. defer runs scripts in document order after the HTML is parsed; async runs each script as soon as it downloads, in any order
Explanation:
Use defer for scripts that depend on each other or on the DOM.