var graphdata = [["A", "B", "C", "D"], [0.5, 0.25, 0.5, 0.25]];
function randomData (){
var labels = graphdata[0]
var labels2 = graphdata[1];
console.log();
return labels.map(function(labels, labels2){
console.log(labels2);
return { label: labels , value: labels2 }
});
}
labels
are iterating correctly for A, B, C, D, but labels2
is getting squashed to 0, 1, 2, 3 and I'm unsure why. Just before the return labels.map()
call, if I console.log()
, I can see the proper fractions being output but afterwards those values disappear and I am puzzled as to why.