Módulos de importação JS HTML
<script type="module" src="main.js"></script>
Ugliest Unicorn
<script type="module" src="main.js"></script>
export const name = "Jesse";
export const age = 40;
// importing greetPerson from greet.js file
import { greetPerson } from './greet.js';
// using greetPerson() defined in greet.js
let displayName = greetPerson('Jack');
console.log(displayName); // Hello Jack
import { greet } from '/.greet.js';
// exporting a function
export function greetPerson(name) {
return `Hello ${name}`;
}
export function greetPerson(name) {
...
}