JavaScript中的数组交集

我很困惑,这个问题促使我用JavaScript编写一个函数,该函数计算两个数组并返回两个数组包含多少个匹配项的数值。似乎很简单,但是在函数中编写了循环之后,我不确定该去哪里。

这是我写的:

function gradeQuiz(studentAnswers, teacherAnswers) {
  for (let i = 0; i < studentAnswers.length; i++) {
    let student = studentAnswers[i]
  for (let x = 0; x < teacherAnswers.length; x++) {
    let teacher = teacherAnswers[x]

  }
  }
  }

  gradeQuiz(["C","D","B"],["C","A","B"])