import a javascript file into another code example
Example 1: include other js files in a js file
document.writeln("<script type='text/javascript' src='Script1.js'></script>");
document.writeln("<script type='text/javascript' src='Script2.js'></script>");
Example 2: javascript using another js file
export function hello() {
return "Hello";
}
import {hello} from 'module';
let val = hello();
Example 3: javascript include a js file from another
$.getScript('/path/to/imported/script.js', function()
{
});
Example 4: how to call a script from another script in javascript
<script type="text/javascript" src="file1.js"></script>
<script type="text/javascript" src="file2.js"></script>
<script type="text/javascript">
alertOne( );
</script>
Example 5: how to call a script from another script in javascript
function alertNumber( n ) {
alert( n );
};
function alertOne( ) {
alertNumber( "one" );
};
alertOne( );