function access variable in module.exports file in nodeJs I would like to find the best way to access function variables that are being used as parameters in other functions in another module. The parsefile.js is a Node.js script that is exported as package module and two functions. getfirst and getsecond need to access the variables that are passed from index.js like 'a', 'b' from  parsefile('a', 'b', 'c'). Other than using global, do we have another way to do it?
// index.js from some application
const parsefile = require('./parsefile')
parsefile('a', 'b', 'c')


//parsefile.js exports about package module
function getfirst() {
  if (global.f &amp;&amp; global.s) {
    return `i have totally 2 arguments: ${global.f}///${global.s}`
  }
  return `first arguments is ${global.f}`
}

function getsecond() {
  return `second arguments is ${global.s}`
}

module.exports = (...args) =&gt; {
  global.f = args[0];
  global.s = args[1];
  Promise.all([getfirst(), getsecond()]).then(([first, second]) =&gt; {
    console.log(`return from getfirst: ${first}`);
    console.log(`return from getsecond: ${second}`);
  });
}
Since getfirst() and getsecond() are called only within parsefile.js, you can just define an object inside this file (something like this const local = {} at the top of your file) and use it instead of global.