multiple exports javascript code example

Example 1: js export multiple functions

function foo() { console.log('foo') }
function bar() { console.log('bar') }
function baz() { foo(); bar() }

export default {foo, bar, baz}

Example 2: js import and export

// helloworld.js

export function helloWorld() {
	return 'Hello World!';
}

// main.js

import helloWorld from './helloworld.js';

console.log(helloWorld());

Example 3: module.exports multiple functions

module.exports = function(firstParam) { console.log("You did it"); },
module.exports = function(secondParam) { console.log("Yes you did it"); }, 
// This may contain more functions