I am trying to load a csv file using below code.
Method 1:
d3.csv("data/aaa.csv", function(error, data) {
console.log(data[1]);
})
The console shows undefined
instead of the data row. Nonetheless, this is the most common method you can find on all forums.
However, if I use below method 2 loading the data, it correctly shows the data row.
Method 2:
d3.csv("data/aaa.csv").then(function(data) {
console.log(data[1]);
});
I am a bit confused why this is happening.