I have an array of exam result, it contains the date the exam was sat and the grade achieved. I want to put all the grades in one array and the dates in another so I can plot them in a chart.js application. How can I separte them?
Results Array example layout:
Results{
[0] {examDate: "2017-10-16T10:30:00", <ResultEntry>grade: A}
[1] {examDate: "2017-15-16T11:00:00", <ResultEntry>grade: C}
[2] {examDate: "2017-16-16T11:30:00", <ResultEntry>grade: B}
[3]{examDate: "2017-20-16T12:00:00", <ResultEntry>grade: B}
}
But what I try doesn't populate the two new arrays
var dateArray;
var gradeArray;
var counter = 0;
for (members in results) {
dateArray[counter] = members[0];
gradeArray[counter] = members[1];
counter++;//increment storage index
}
I have Jquery installed on my project can the .each functionality be used to achieve this?
dateArray[counter] = members.examDateanddateArray[counter] = members.grade