Export modules individually:
export const name = "Jesse";
export const age = 40;
Export all at once:
const name = "Jesse";
const age = 40;
export {name, age};
Can only have one default export in a file:
const message = () => {
const name = "Jesse";
const age = 40;
return name + ' is ' + age + 'years old.';
};
export default message;
Make javascript code available from one file to another.
Multiple imports:
import { name, age } from "./person.js";
Import default export:
import message from "./message.js";
To use modules:
<script type="module" src="main.js"></script>
To import available javascript code.