I have this code, and I am trying to get the data from the function addrBlk to display in console through fs.writeFile. I have tried with this code with these params and this function to display
```let addrBlk = (name, address1, address2, city, state, zip) => {
return name + "<br>" + address1 + "<br>" + address2 +
"<br>" + city + ", " + state + " " + zip;
}```
```fs.writeFile("address.txt", addrBlk, (err) => {
if(err) {
console.log(err);
}
else {
console.log("Address written successfully, address is: ");
console.log(fs.readFileSync("address.txt", "utf8"));
}
});```
and it returns exactly what the return says, I have also tried
```fs.writeFile("address.txt", `${name}`, (err) => {
if(err) {
console.log(err);
}
else {
console.log("Address written successfully, address is: ");
console.log(fs.readFileSync("address.txt", "utf8"));
}
});```
and It returns an error saying name not defined. How can I return this data to a txt file with these params and return message??
through the console. I guess I could use js \n. – Dylan T Jan 24 '23 at 03:31
` to `\n`. – kennarddh Jan 24 '23 at 03:36