From 5be3bb9a118d44fef4a45f30c3b073a4197c35e2 Mon Sep 17 00:00:00 2001 From: Sameh Farouk Abd Elmoaty Abou El Saad Date: Mon, 5 Oct 2020 17:38:05 +0200 Subject: [PATCH] bugfix/evaluating-quiz-answers-fix fixing a bug in evaluating answers consists of multiple-word, the answer would be correct only if user wrote one word from the correct answer. --- .../02_trivia_api/starter/frontend/src/components/QuizView.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/02_trivia_api/starter/frontend/src/components/QuizView.js b/projects/02_trivia_api/starter/frontend/src/components/QuizView.js index a65789ae375..1e3b8236c80 100644 --- a/projects/02_trivia_api/starter/frontend/src/components/QuizView.js +++ b/projects/02_trivia_api/starter/frontend/src/components/QuizView.js @@ -133,7 +133,7 @@ class QuizView extends Component { evaluateAnswer = () => { const formatGuess = this.state.guess.replace(/[.,\/#!$%\^&\*;:{}=\-_`~()]/g,"").toLowerCase() const answerArray = this.state.currentQuestion.answer.toLowerCase().split(' '); - return answerArray.includes(formatGuess) + return answerArray.every(el => formatGuess.includes(el)); } renderCorrectAnswer(){