Skip to content

Instantly share code, notes, and snippets.

@faustoct1
Created July 17, 2022 15:23
Show Gist options
  • Save faustoct1/ccfe4a58c570939568b4e8b0af36bf6c to your computer and use it in GitHub Desktop.
Save faustoct1/ccfe4a58c570939568b4e8b0af36bf6c to your computer and use it in GitHub Desktop.
Exportar e importar múltiplas funções no mesmo arquivo js
const {hello,espaco,world,helloworld} = require('./modulos')
const test = () => {
console.log(`${hello()}${espaco()}${world()}`)
console.log(`${helloworld()}`)
}
(async ()=>{test()})()
const hello = exports.hello = () => {
return "Hello"
}
const espaco = exports.espaco = () => {
return " "
}
const world = exports.world = () => {
return "World"
}
exports.helloworld = () => {
return `${hello()}${espaco()}${world()}`
}
@faustoct1
Copy link
Author

Saída

Hello World
Hello World

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment