i am a bit lost:
I am trying to make a variable available in another function, since i do need the return for something else already. i thought i could just make the variable global available and import it in FileB, whats wrong and might there be a better way? thanks a lot
FileA:
const variableToPass = null;
module.exports = (env) => {
variableToPass = env;
const varA = require(`./FileB.js`);
const varB = doThis(varA, …doSomething());
return varB;
};
module.exports = variableToPass;
FileB:
const variableToPass = require(‚./.FileA‘);
console.log(variableToPass);
it does log : { [Function] variableToPass: null }