I am trying to create a dictionary of data for each state, but when I do this it says that mapData["Alabama"] is undefined and that the object has no keys. When I print it to the console it prints out as an object with each state as a key.
let mapData = {};
d3.csv("./resources/states/us_2016_states.csv" , function(data) {
data.forEach(function(d){
mapData[d.State] = {"score": 0, "count":0, "state": d.State}
})
})
console.log(Object.keys(mapData))
console.log(mapData["Alabama"])