preload for js 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>