en.javascript.info/1-js/2-first-steps/2-external-script/2-async-defer-first/task.md
Ilya Kantor 8ba2c6b17c en
2015-08-17 12:41:38 +03:00

533 B

Which script executes first?

[importance 4]

In the questions below, there are two scripts: small.js and big.js.

If we assume that small.js loads much faster compared to big.js -- which script executes first?

<script src="big.js"></script>
<script src="small.js"></script>

What if we add async?

<script async src="big.js"></script>
<script async src="small.js"></script>

What if we switch to defer?

<script defer src="big.js"></script>
<script defer src="small.js"></script>