How can create a function that is only used in mymodule.js
but is also accessible from outside mymodule.js
Of course i could also do:
module.exports = {
  myfunction: function() {
    return "HELLO";
  },
};
But isnt there a way to declare a function once and export it later?
mymodule.js:
var x = function P(inp) {
    console.log('P');
}
module.exports = {
    method: x(),
}
other.js:
var mac = require('./mymodule.js');
mac.x(); //<-- does not work
 
     
    