Average the Scores
Write the code, see it run, pass the checks.
The problem
- easy
- Code
The Scores component gets a scores prop: a list of { name, score } objects (the preview uses Ada 82, Ben 67, Cleo 95 and Dev 74). Show each as a list item reading like "Ada: 82". Below the list, show three lines that aren't list items: "Average: 79.5" (the mean, always to one decimal place, so 85 shows as "85.0"), "Highest: Cleo (95)" and "Lowest: Ben (67)" (on a tie, the one that comes first in the list). With an empty list, show "No scores yet" instead of the three lines. Work them out from the prop while rendering, rather than copying them into state, so they stay right when the prop changes.
Your code must pass
- Lists each student and their score
- Shows the average to one decimal place
- Names the highest and lowest scorers, first on a tie
- Updates when the scores prop changes
- Shows "No scores yet" for an empty list