我有一个全局变量说:
var series,hours;
var loadData = function(){
series = [[]];
hours = [];
d3.json("data/radar.json", function(error, data) {
data.QualitySummaryObject.forEach(function(d,i) {
series[i] = d.extractPercentage;
hours[i] = d.extractorName;
});
});
console.log(hours);
};
现在,如果我试图访问这个 console.log 它工作正常,但是。
var print = function(){
console.log(hours); //here its not working no value in hours why ... ?
}