I'm very new to using JavaScript and d3. I got this example from a tutorial, but can't get it to log the items to the console. Does anyone see something wrong with this HTML file?
This is it in its entirety:
<meta charset="utf-8"/>
<script src="https://d3js.org/d3.v5.min.js"></script>
<script>
d3.csv("data/employee.csv", function(data) {
for (var i = 0; i < data.length; i++) {
console.log(data[i].Name);
console.log(data[i].Age);
}
});
</script>
If i swap out the for loop for
console.log(data);
I do see the object details in the console:
However, with the original snippet above the console shows nothing. Here is my CSV, any help would be appreciated:
Name,Age
John,30
Jane,32
Thanks!