// Create new script element const script = document.createElement('script'); script.src = '/path/to/js/file.js'; // Append to the `head` element document.head.appendChild(script);