I want to determine how many of the items in these two arrays match, then store that in state as a number.
For example
const [score, setScore] = React.useState(0)
const selections = ["one", "two", "three"]
const allCorrectAnswers = ["four", "two", "three"]
// this should return 2
I tried
function checkSelectedAnswer(selections, allCorrectAnswers) {
  selections.map(eachChoice =>
    eachChoice === allCorrectAnswers.map(eachAnswer => eachAnswer) 
      ? setScore(prevScore => prevScore + 1) : 0
  )
}
Please explain why my code isn't working as well if you can.
 
     
     
     
     
    