preload function in javascript code example
Example: preload javascript
<link rel="preload" href="main.js" as="script">
<script src="main.js" defer></script>
<link rel="preload" href="main.js" as="script">
<script src="main.js" defer></script>