🚀 LEVEL UP TO SENIOR:Unlock 500+ Advanced Practical Challenges & Expert Masterclasses.
🎓 COURSERA PARTNER:Earn professional Google, Meta, and IBM certificates to supercharge your resume.
REFERENCEhtml

html Documentation

LOADING ENGINE...

HTML <script> Tag

Embed or reference JavaScript. Learn inline, src, defer, and async.

script.html
<!-- External script with defer -->
<script
src="app.js" defer></script>
📜
script.html
1 / 7
📜

Tutor:The <script> tag embeds or references executable JavaScript. You can write code inline between the tags or load an external file with the src attribute. Scripts run in order and block HTML parsing by default.


Script Mastery

Unlock nodes by learning the script tag, src, defer, and async.

Concept 1: The Script Tag

The <script> tag embeds or references JavaScript. Inline: code between the tags. External: src="url". Scripts run in order and block HTML parsing by default.

System Check

What does the <script> tag do?


Community Holo-Net

Share Script Patterns

Using <script> with defer, async, or modules? Share your patterns.

Enjoying this guide?

Codesyllabus is 100% free and open-source. Support our mission, pay for server infrastructure, and fuel new tutorials by buying us a coffee!

HTML <script> Tag

Author

Pascual Vila

Frontend Instructor.

The <script> tag embeds or references executable JavaScript. Use inline code between the tags or load an external file with the src attribute. Scripts block HTML parsing by default; use defer or place at end of body for better performance.

src and inline

Inline: <script>code</script>. External: <script src="app.js"></script>. Do not put code inside the tag when using src. The type attribute defaults to text/javascript.

defer and async

defer: script runs after the document is parsed, in order. async: script runs when available, order not guaranteed. Use defer for DOM-dependent scripts; use async for independent scripts like analytics. Prefer defer or scripts at end of body to avoid blocking rendering.

Script Tag Glossary

<script>
HTML element that embeds or references executable JavaScript. Inline: code between tags. External: use src attribute. Blocks parsing by default.
defer
Attribute: script runs after the document is parsed, in order. Use for scripts that need the DOM. Does not block parsing.
async
Attribute: script runs when available, order not guaranteed. Use for independent scripts (e.g. analytics). Downloads in parallel.