Load the sample script file.
Acceptance criteria
- 1.Load the sample script file.
HTML Tutorial · HTML Tags
These 10 tasks go with the HTML <script> Tag chapter. 5 of them ask you to build something small from scratch; 5 give you code that is already broken and ask you to work out why. Set aside about 90 minutes for the whole set, though you can do them in any order.
Nothing here is marked by a person. When you press Submit, the editor checks your code against the points listed under each task and tells you straight away what passed and what didn't (you need a free account to submit). If you get stuck, there are hints, and a worked solution once you've had a go. The first 2 tasks are free; the rest are part of the practice plan.
If it's been a while since you read the chapter, here is how it starts: “The tag is used to embed or reference JavaScript code in an HTML document. It allows you to create interactive features, handle events, manipulate the DOM, and perform dynamic operations on a webpage.” .
1.Load a scriptexercise · easy · 10 min
Load the sample script file.
Passes when: Load the sample script file.
2.Defer the scriptexercise · easy · 10 min · practice plan
Let the page finish parsing before running the script.
Passes when: Let the page finish parsing before running the script.
3.Load it as a moduleexercise · easy · 10 min · practice plan
Load the file as an ES module.
Passes when: Load the file as an ES module.
4.Load it asynchronouslyexercise · easy · 10 min · practice plan
Let an independent script load without blocking.
Passes when: Let an independent script load without blocking.
5.Two deferred scriptsexercise · medium · 10 min · practice plan
Load two files, both deferred so their order is kept.
Passes when: Load two files, both deferred so their order is kept.
6.Fix the wrong attribute for the filebug fix · easy · 8 min
Scripts point at their file with src.
Passes when: Scripts point at their file with src.
7.Fix the blocking scriptbug fix · easy · 8 min · practice plan
Defer it so it does not hold up parsing.
Passes when: Defer it so it does not hold up parsing.
8.Fix the module loaded as a classic scriptbug fix · easy · 8 min · practice plan
A file using import needs type="module".
Passes when: A file using import needs type="module".
9.Fix the wrong value for async loadingbug fix · easy · 8 min · practice plan
Independent scripts use the async attribute.
Passes when: Independent scripts use the async attribute.
10.Fix the second script not deferredbug fix · easy · 8 min · practice plan
Both must defer for their order to be kept.
Passes when: Both must defer for their order to be kept.
Between them these tasks cover Loading scripts, defer and async and type=module.
Looking for a different chapter? See every practice set, or switch to the interview theory questions.