Currently, I am working on storing an array in a .json file using NodeJS. However, when trying to execute the code below, I encountered an error message saying require is not defined
. Can someone provide some guidance on how to resolve this issue?
let answersString = JSON.stringify(answersArray);
const fs = require('fs');
fs.writeFileSync("answers.json", answersString);
Thank you in advance!
UPDATE: After conducting further research and gaining more knowledge about node, bundling, and testing, I now realize that my initial question was quite basic. Apologies for any confusion.