I’m rendering a template literal with a placeholder inside my conditional operator, but it seems there is an issue I can’t identify. Any clue as to what this may be?
function scoreQuiz() {
let totalCorrect = 0;
allCorrectAnswers.forEach((answer, index) => {
if(answer === selections[index]) {
totalCorrect++;
}
})
}
{finished === false ?
<button
onClick={() => {
//checkSelectedAnswer();
scoreQuiz();
finishQuiz()
}
}>
Check answers
</button>
:
`You scored ${totalCorrect}/5 correct` <button>Play again</button>
}