mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-28 18:26:54 +00:00
fix(curriculum): replace unrelated HTML defer/async question with a new one (#60855)
Co-authored-by: Krzysztof G. <60067306+gikf@users.noreply.github.com> Co-authored-by: Huyen Nguyen <25715018+huyenltnguyen@users.noreply.github.com>
This commit is contained in:
+8
-8
@@ -46,35 +46,35 @@ In short, use `async` for scripts where the order of execution doesn't matter, a
|
||||
|
||||
## --text--
|
||||
|
||||
What happens when a script tag has both `async` and `defer` attributes?
|
||||
What is the advantage of using the `defer` attribute in a `<script>` tag?
|
||||
|
||||
## --answers--
|
||||
|
||||
The script is downloaded asynchronously and executed immediately after download.
|
||||
It helps differentiate the script from `async` scripts.
|
||||
|
||||
### --feedback--
|
||||
|
||||
Consider which attribute takes precedence when both are present.
|
||||
Remember the purpose and differences of the `defer` and `async` attributes.
|
||||
|
||||
---
|
||||
|
||||
The script is downloaded asynchronously and executed after HTML parsing is complete.
|
||||
It reduces memory usage during page load.
|
||||
|
||||
### --feedback--
|
||||
|
||||
Consider which attribute takes precedence when both are present.
|
||||
The `defer` attribute has nothing to do with memory management.
|
||||
|
||||
---
|
||||
|
||||
The `defer` attribute is ignored, and the script behaves as if only `async` was present.
|
||||
It can improve the overall page loading performance.
|
||||
|
||||
---
|
||||
|
||||
The browser throws an error.
|
||||
It lets developers set a custom delay time before scripts run.
|
||||
|
||||
### --feedback--
|
||||
|
||||
Consider which attribute takes precedence when both are present.
|
||||
The `defer` attribute doesn't execute scripts on a custom timer.
|
||||
|
||||
## --video-solution--
|
||||
|
||||
|
||||
Reference in New Issue
Block a user