I have some data stored in an array in javascript and want to use that array in node js. I tried this:
JS:
let myArray = ['data1', 'data2'];
Node js:
let myArray = require('scripts.js').myArray;
But I get Error: Cannot find module error.
What should I do?
'./public/scripts/scripts'. Or'./scripts'if the file was in the root folder. Notice the dot in the front of the string.