Here's the code:
var stronglyAgree = [];
var agree = [];
var disagree = [];
var stronglyDisagree = [];
var na = [];
for (var i=0; i<survey.questions.length; i++) {
var tempArray = [];
tempArray[0] = i*8;
tempArray[1] = survey.questions[i].answers[0].count;
stronglyAgree.push(tempArray);
console.log(tempArray);
tempArray[1] = survey.questions[i].answers[1].count;
agree.push(tempArray);
tempArray[1] = survey.questions[i].answers[2].count;
disagree.push(tempArray);
tempArray[1] = survey.questions[i].answers[3].count;
stronglyDisagree.push(tempArray);
tempArray[1] = survey.questions[i].answers[4].count;
na.push(tempArray);
}
console.log(stronglyAgree);
As you can see, I'm logging the tempArray, which is being pushed to stronglyAgree. When it comes to the last question, for example, I get:
`tempArray = [72,1]`
But the last array in stronglyAgree is [72,0], which doesn't seem right to me. What am I doing wrong here?