// index.js
let intro = document.getElementById('intro');
let name = "Harry";
module.exports = name;
// new.js
let name = require("./index.js");
console.log(name);
I am trying to build an application with Node.js. When I want to export a string or specific data with module.exports to use it in the new.js file, an error is logged in the console saying that "document is not defined". All I need is to export a variable having a string to my Node.js (new.js). Also my index.js have multiple document.getElements. I also noticed that when I remove document.getElements then I successfully import that data from index.js without any error. How could I export data from index.js file with that document.getElement present in that?