I have an obejct of the form:
var test = {"2011":{"10":4,"9":9,"8":15,"7":11,"6":11,"5":13,"4":9,"3":5,"2":9,"1":4,"0":20},"2010":{"11":9,"10":23,"9":58}}
I want to iterate over this so I can hit each year and month combo. I have:
var years = d3.keys(test),
months = d3.range(12),
data = [];
So, as a Javascript newbie, to sanity check things I inspect years
.
document.writeln(years)
2011,2010
Cool, but when I try to iterate over the years
array to pull data out of test
the elements I do what I think is correct to test, but the elements are lost:
for(var y in years) {
document.writeln(y);
}
0,1
How do I iterate over years
to get the actual elements (2011,2010
) in them?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…