1//Inside lib file declare functions
2const animalName = (name) => {
3 console.log(name)
4}
5const animalSound = (sound) => {
6 console.log(sound)
7}
8//Export these both as JSON
9module.exports = {animalName, animalSound}
10
11//Navigate to file you want to use them and import
12const animalLib = require('./location_of_file.js')
13
14//To access the function
15animalLib.animalName("zebra")
1function foo() { console.log('foo') }
2function bar() { console.log('bar') }
3function baz() { foo(); bar() }
4
5export default {foo, bar, baz}