title: match objects then calculate grade for student grade
body: <p>I'm stuck with a problem.</p>
  <p>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:</p>
  <pre><code> const answerkeys = {math01: a, math02: b, math03 : d, ...}
  </code></pre>
  <p>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:</p>
  <pre><code>const scoring = {math01: 5, math02: 10, math03: 5, ...}
  </code></pre>
  <p>And then the students' answers are stored like this:</p>
  <pre><code>const answers = {0: {math01: a, math02: c, ... }
             1: {math01: b, math02: a, ... }
             2: {math01: a, math02: c, ... }
             ...
             }
  </code></pre>
  <p>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.</p>
  <p>So i tried doing it this way:</p>
  <pre><code>const studentAnswers = answers.map((elem) =&gt; {return elem});
  
  studentAnswer.filter(answer =&gt; answerkeys.includes(answer));
  </code></pre>
  <p>But it is giving me</p>
  <blockquote>
  <p>&quot;result.js:82 Uncaught TypeError: Cannot read properties of undefined
  (reading 'filter')&quot;</p>
  </blockquote>
  <p>How to compare between &quot;answerkeys&quot; and &quot;answers&quot; and then calculate the scores using &quot;scoring&quot;?</p>