I have 2 javascript files:
In first.js:
const { number } = require('./second.js');
const numEnum = {
NUM1: 5,
NUM2: 10
}
const useNumber = () => {
console.log('The chosen num is:' chosenNum.numberVal);
}
module.exports = {
numEnum
};
And in second.js
const { numEnum } = require('./first.js');
const chosenNum = {
numberVal: numEnum.NUM1
}
module.exports = {
chosenNum
};
But there's a loop. The first file needs the export from the second file which uses the first file.
How should I solve it? Is there a way besides using a third file?