Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

module.exports in js

module.exports = {
    method: function() {},
    otherMethod: function() {},
};


const myModule = require('./myModule.js');
const method = myModule.method;
const otherMethod = myModule.otherMethod;
// OR:
const {method, otherMethod} = require('./myModule.js');
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #js
ADD COMMENT
Topic
Name
8+6 =