What's the best way to load a JavaScript file in HTML? HTML async vs defer

The first thing you learn in JavaScript is to load a JavaScript file into an HTML file. But do you know there are more than a couple of ways to do that? Do you know the right way? Do you care for the users who are on the slower network? This video teaches you how to load a JavaScript file so your users will not encounter performance and data loss issues. Learn about the async and defer HTML attributes to become a better developer. Don't forget, it is a tricky interview question too! 🤯 Timecodes 0:00 - Why care about Script loading? 01:00 - The Secret Santa Game 02:02 - Issue with loading a JavaScript file into the head 06:15 - The dirty fix: Move it to the end of the body! 07:45 - Understanding the problem visually 10:20 - What is the async attribute in HTML, and when to use it? 18:13 - What is the defer attribute in HTML, and when to use it? 19:14 - async vs defer 23:36 - Wrapping Up Important Links: -------------------------- Source Code used in the Video: https://github.com/atapas/youtube/tre... Like what I shared? Please support me 🙏 by sponsoring my contribution to the community. It will help me to do much better content creation in the future. 🤝 The Sponsor Link: https://github.com/sponsors/atapas My Socials: Twitter:   / tapasadhikary   Showwcase: https://www.showwcase.com/atapas398 LinkedIn:   / tapasadhi.  . Blog: https://blog.greenroots.info/ GitHub: https://github.com/atapas