Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to export a function in nodejs

function foo(x, y) {
  return x + y;
}

function bar(x, y) {
  return x - y;
}

//You can also export numbers, classes, objects, etc
const foobar = 33;

module.exports = { foo, bar, num };
Source by www.stanleyulili.com #
 
PREVIOUS NEXT
Tagged: #export #function #nodejs
ADD COMMENT
Topic
Name
7+7 =