Skip to content

Instantly share code, notes, and snippets.

@hritik5102
Last active April 8, 2024 21:42
Show Gist options
  • Save hritik5102/5ef1bc1dd04f91c56f09124c0ceca48a to your computer and use it in GitHub Desktop.
Save hritik5102/5ef1bc1dd04f91c56f09124c0ceca48a to your computer and use it in GitHub Desktop.
Async (load-first order)
<p>...content before scripts...</p>
<script>
document.addEventListener('DOMContentLoaded', () => alert("DOM ready!"));
</script>
<script async src="https://javascript.info/article/script-async-defer/long.js"></script>
<script async src="https://javascript.info/article/script-async-defer/small.js"></script>
<p>...content after scripts...</p>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment