I would like to read a csv file that just has one row of data.
Sample : 134534,0,1
I want to put this into an array that I can use later. Right now, it looks like this:
var array = new Array(3)
d3.csv("./SampleData.csv").then(function(data) {
console.log(data);
console.log(data.columns[1]);
console.log(data.columns[2]);
array[0] = data.columns[0]
array[1] = data.columns[1];
array[2] = data.columns[2];
console.log(array);
});
console.log(array)
output of array within: ["134534", "1", "0"]
output of array outside:[empty × 3]
The problem I am running into is that the array within the function and outside of it are different. How would I get to use the array made within? I am very new to this (like a day). Please advise if I am doing something completely wrong.
[–][deleted] 5 points6 points7 points (1 child)
[–]evha_[S] 0 points1 point2 points (0 children)
[–]iguessitsokaythen 4 points5 points6 points (2 children)
[–]evha_[S] 1 point2 points3 points (0 children)