I want to store a CSV file in a variable, which I can use later. Currently, I am using Vue and d3 to do this
let app = Vue.createApp({
data: function(){
return{
loaddata: {}
}
},
methods:{
async greet(){
let data = await d3.csv("a.csv",function(data){d3.select("#output").html(data.map(function(d){return d.c;}));
});
this.loaddata=data,
console.log(this.loaddata)
},
greet2(){
for (const {c,b} in this.loaddata){
console.log(c,b);
}
}
}
})
app.mount('#app')
</script>
greet is just a method that activates when I click enter in my frontend. So basically my end goal is to get variable (array) that I can use with loops to display the CSV in the frontend. If there is another way to load and store a csv file in a variable (array), I will be very grateful if you could let me know that.
I tried searching a lot but couldn't find a solution, I apologize if this is a noob question, I am very new to javascript.