export multiple functions nodejs es6 code example
Example 1: node module export multiple functions
const animalName = (name) => {
console.log(name)
}
const animalSound = (sound) => {
console.log(sound)
}
module.exports = {animalName, animalSound}
const animalLib = require('./location_of_file.js')
animalLib.animalName("zebra")
Example 2: js export multiple functions
function foo() { console.log('foo') }
function bar() { console.log('bar') }
function baz() { foo(); bar() }
export default {foo, bar, baz}