<video src="https://res.cloudinary.com/dq8xfyhu4/video/upload/q_auto/v1653682630/FM%20Workshop/design-patterns/module-pattern/Screen_Recording_2022-05-27_at_3.15.38_PM_j40sjt.mov" controls="controls" style="width: 100%;" ></video>
<video src="https://res.cloudinary.com/dq8xfyhu4/video/upload/q_auto/v1654008290/FM%20Workshop/design-patterns/module-pattern/Screen_Recording_2022-05-31_at_9.43.04_AM_dbq340.mov" controls="controls" style="width: 100%;"></video>
- a html doc can have multiple `script` tag
- `script` are executed in order in an html doc.
- we can access properties defined in scripts that are loaded prior to the currently running script.
With modules however, we can only use the values that have been exported.
## How to Use Module?
in browser, when adding JavaScript to HTML files directly, you can use modules by adding the `type="module"` attribute to the `script` tags.
<video src="https://res.cloudinary.com/dq8xfyhu4/video/upload/q_auto/v1653509683/FM%20Workshop/design-patterns/module-pattern/Screen_Recording_2022-05-25_at_3.12.53_PM_t2xcdy.mov" controls="controls" style="width: 100%;"></video>
In Node, you can use ES2015 modules either by:
- Using the `.mjs` extension
- Adding `"type": "module"` to your `package.json`