I am using a function from one file, in another file, and calling it there. This is causing the function to run twice at the same time when ran in command line, but not when I run it in VSCode.
Here is an example:
// fileOne
async function task() {
console.log('Hello')
}
module.exports = { task }
// fileTwo
const fileOne = require('./fileOne');
fileOne.task();
Output when ran in VSCode:
Hello
Output when ran in Command Line:
Hello
Hello
Im not sure why this is happening... No I am not calling it in fileOne on accident because then it would run twice in VSCode as well.
Thanks.
from Why is my function running twice in command line but not in vscode
No comments:
Post a Comment