| 77 | }; |
| 78 | |
| 79 | function giveFeedback() { |
| 80 | let scoreP = parseInt(((score / questions.length) * 100).toPrecision(3)); |
| 81 | if (scoreP === 100) { |
| 82 | return "Excellent! You aced the test!"; |
| 83 | } else if (scoreP >= 80) { |
| 84 | return "Great job! You did very well."; |
| 85 | } else if (scoreP >= 60) { |
| 86 | return "Good effort! You passed with a solid score."; |
| 87 | } else if (scoreP >= 50) { |
| 88 | return "Keep practicing! You're on the right track."; |
| 89 | } else { |
| 90 | return "Keep at it! Let's review and improve."; |
| 91 | } |
| 92 | } |
| 93 | useEffect(() => { |
| 94 | setFeedback(giveFeedback()); |
| 95 | }, [score]); |