import file js 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 import
import { module } from "./path"; // single module
import Module from "./path"; // default export
import Module, { module } from "./path"; // both
Example 3: how to call a script from another script in javascript
// File1.js
function alertNumber( n ) {
alert( n );
};
// File2.js
function alertOne( ) {
alertNumber( "one" );
};
// Inline
alertOne( ); // No errors