JavaScript For Web
Moving To a JavaScript File
Up to now, we’ve been writing our JavaScript inside the HTML file using a <script> tag. That works for small examples, but as your projects grow, it becomes messy.
A better way is to write your JavaScript in its own file (for example, script.js) and connect it to your HTML. This keeps your HTML, CSS, and JavaScript separate, each handling its own job.
Members only
Keep reading this lesson
You've reached the end of the free preview. Unlock the rest of this lesson plus 10 more lessons in JavaScript For Web.
- Unlimited coding questions
- Unlimited access to all classroom material
- Weekly live call for questions and guidance
- 3,000 AI tutor tokens / month
- Personal SQL database (3 MB)
- Progress tracking
Cancel any time.