JavaScript ES6 Modules
======================
ES6 modules provide a number of useful features. Perhaps the most important of these is the ability to keep your JavaScript in separate scopes. This means you do not have to worry about a variable in your code having the same name as a variable in some other JavaScript code on a given page. This is achieved without the need for namespaces. It is this aspect of ES6 modules that I want to discuss here but it is important to know about the other properties that ES6 modules have and some of these will be considered. The intention of this article is to illustrate some behaviours of ES6 modules in order to make it easier to use them effectively. The article does not attempt to describe how they should be used in production code. There is a section on further reading at the end which may be helpful for that and other information.
In an HTML document, JavaScript is deployed by using the HTML, ````
If the JavaScript was written in a file called `main.js` in the same directory as the HTML document that needs to use the JavaScript, it could be used by including this code in the HTML document: ````.
ES6 modules behave as if they had the ``defer`` attribute. Normally one would have to write ``