3D Gallery with Great Artwork Imagine Logo with Three Colors Beach Cabin 3D Android Tablet with Different Screens Studio Apartment Red Figured Greek Vase on Blue Background Silver and Gold Flashlight Lake on Fire

JavaScript: Simple Module Example

Page 7a

Simple Module Example

When this Web page loads, the following import script executes, from the header. The script imports module file, export-first-header.js. Then the script calls module function, function popupMessage(s), declared in export-first-header.js. The only parameter to popupMessage() is a string that says, First Module, however you can pass any string to popupMessage(), in your import file.

<script 
type="module"
>
import * as m from './javascript/export-first-header.js';

// Use exported values from
// export-first-header.js:
m.popupMessage('First Module');

</script>

Return to Full Tutorial

Tap the left arrow button, above, the 7 button below, or just return to JavaScript Advanced > Modules for more information about importing and exporting JavaScript modules.

Learn JavaScript

JavaScript's the foundation of Web developer and Website design skills. This free and unique JavaScript tutorial includes some new or seldom used, but useful features.

Tags
canvas drawing, web design, web designing course, how to become a web developer, coding websites, website developers,learning web design, html web design, html5 canvas tutorials, coding Website, html5 canvas, learn to code, html5 canvas tutorial,learn html tutorial, simple html tutorial

Ads >
Create 3D Games: Learn WebGL Book 2 Simple Shaders: Learn WebGL Book 4
3D Programming for Beginners: Learn WebGL Book 1

for Web graphics!

Copyright © 2022 Amy Butler. All Rights Reserved.