Last active
April 8, 2024 20:21
-
-
Save hritik5102/a600df69e78982f5fb9aa84b3a0899cd to your computer and use it in GitHub Desktop.
Normal Script Loading - Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<title>Async vs Defer</title> | |
<script> | |
console.log('Start HTML Parsing'); | |
</script> | |
</head> | |
<body> | |
<p>Hello, World</p> | |
<!-- external script --> | |
<script src="index.js"></script> | |
<div class="content"> | |
<span>Span element</span> | |
</div> | |
<script> | |
console.log('End HTML Parsing'); | |
</script> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let sum = 0; | |
for (let i = 0; i < 10000000; i++) { | |
sum += i; | |
} | |
console.log('Script is Executed, Sum is : ', sum); | |
window.addEventListener('DOMContentLoaded', function () { | |
console.log('DOMContentLoaded event fire'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment