Ways to Include Javascript in HTML | Mastering of Web development
HTML-код
- Опубликовано: 14 июн 2024
- Summary
This video explains the different ways to include JavaScript within an HTML file, focusing on the advantages and disadvantages of internal and external scripts.
Highlights
- 💻 *Internal scripts* are written directly inside the HTML file using the `script` tag. This is useful for small pieces of code, but can become cumbersome for larger projects.
- 🗃️ *External scripts* are separate JavaScript files linked to the HTML using the `script` tag with an `src` attribute. This promotes code organisation, reusability, and readability, making it ideal for larger projects.
- 💡 *Placement matters.* Placing the `script` tag in the `head` will run the script before the HTML content is loaded, while placing it in the `body` will run it after.
- ⚠️ **External scripts require separate HTTP calls**, potentially slowing down page load times for small scripts.
- 🌐 **External scripts are generally preferable for larger projects**, offering better code organisation and reusability.
Telegram Link
t.me/techshareskk
Instagram
/ tech.share.skk
Playlist links
Angular Project
• User & Notes Managemen...
Angular Tutorials Zero to Hero
• Angular Tutorials
Angular Unit Testing
• Angular Unit Testing
For Angular Reactive forms
• Angular Reactive forms
For Javascript Objects Series
• Javascript Objects
For Concepts of JavaScript
• Concepts of JavaScript
For Projects and POC
• Projects and POC
#webdevelopment #html #css #javascript - Наука