I try to log a foreach callback to a file inside my node app. I try to use:
var logger = fs.createWriteStream('tests/temp.js', {
flags: 'a'
})
req.body.selection.forEach(myFunction(logger));
logger.end() // close string
In the callback I try:
function myFunction(mylogger,postvalue) {
Object.entries(myJsonData.testCases).forEach(([key, value]) => {
if(postvalue == key){
console.log("gefunden");
mylogger.write('some data') // append string to your file
}
});
}
But this is wrong. Anyone can help me t find the brainbreak?