I'm stuck with a problem.
So i'm making this student grading system. The way it works is that the system should be able to match answer key with a student's answer. The answer keys are stored like this:
const answerkeys = {math01: a, math02: b, math03 : d, ...}
There is also a grading system where math01 is worth 5 points, and math 02 worth 10 points, etc. Out of confusion, i saved the data in another set of data collection as something like this:
const scoring = {math01: 5, math02: 10, math03: 5, ...}
And then the students' answers are stored like this:
const answers = {0: {math01: a, math02: c, ... }
1: {math01: b, math02: a, ... }
2: {math01: a, math02: c, ... }
...
}
At first, logically i thought i can iterate answers, then the individual result will be matched with answerkeys and the returned (matches) will then be multiplied with answerkeyandscore.
So i tried doing it this way:
const studentAnswers = answers.map((elem) => {return elem});
studentAnswer.filter(answer => answerkeys.includes(answer));
But it is giving me
"result.js:82 Uncaught TypeError: Cannot read properties of undefined (reading 'filter')"
How to compare between "answerkeys" and "answers" and then calculate the scores using "scoring"?