Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
I am approving your solution. Great job implementing the logic to parse the data and calculate the total and average populations! The core functionality is working perfectly. One small suggestion for improvement is to round the average population to a whole number before displaying it. This will make it visually consistent with the other population figures on the page, which are all integers. You can easily achieve this using Math.round(). Keep up the great work!
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
Footnotes
| const average = numbers.length ? total / numbers.length : 0; | ||
|
|
||
| const formattedTotal = total.toLocaleString(); | ||
| const formattedAverage = average.toLocaleString(); |
There was a problem hiding this comment.
The average calculation will likely result in a number with decimal places. Using toLocaleString() directly on it will preserve these decimals. To match the integer-only style of the population numbers in the list, consider rounding the average to the nearest whole number before formatting it.
DEMO LINK