Home

Modules.

<script src="main.js" type="module"></script>
import { isEmpty, EMPTY_STRING as E } from "./module.js"; import MathUtils from "./bigmodule.js"; // default import document.getElementById( "output" ).innerHTML = "isEmpty: " + isEmpty( E ); document.getElementById( "output" ).innerHTML += "<br>sqrt(PI): " + MathUtils.sqrt( MathUtils.PI );
function isEmpty( s ) { if( s == null || s == undefined ) { return true; } if( s.trim().length == 0 ) { return true; } } const EMPTY_STRING = ""; export { isEmpty, EMPTY_STRING };
let MathUtils = { sqrt: function( x ) { return Math.sqrt( x ); }, PI: Math.PI }; export default MathUtils;