tag de script para incluir arquivo js
<script type="text/javascript" src="path-to-javascript-file.js"></script>
Aggressive Antelope
<script type="text/javascript" src="path-to-javascript-file.js"></script>
function loadScript( url, callback ) {
var script = document.createElement( "script" )
script.type = "text/javascript";
script.onload = function() {
callback()
};
}
// call the function...
loadScript("js/myscript.js", function() {
alert('script ready!');
});
document.writeln("<script type='text/javascript' src='Script1.js'></script>");
document.writeln("<script type='text/javascript' src='Script2.js'></script>");
var imported = document.createElement('script');
imported.src = '/path/to/imported/script';
document.head.appendChild(imported);
// jQuery
$.getScript('/path/to/imported/script.js', function()
{
// script is now loaded and executed.
// put your dependent JS here.
});
<script type="module">
import { hello } from './hello.mjs'; // Or the extension could be just `.js`
hello('world');
</script>