I'm new to Javascript, maybe you can help me understand this. The csvtojson examples here all show logging to the console which works fine:
https://www.npmjs.com/package/csvtojson#from-csv-file-to-json-array
const csvFilePath='<path to csv file>'
const csv=require('csvtojson')
csv()
.fromFile(csvFilePath)
.then((jsonObj)=>{
console.log(jsonObj);
})
My question is - how do I use jsonObj outside of this scope? I just want a simple global variable that I can access the JSON with later in the script.