Repository navigation
Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Your solution requires changes due to a critical issue. The average calculation uses a hardcoded divisor of 9 (e.g., totalResult / 9) instead of dynamically using pop.length. This makes the code fragile and produces incorrect results if the number of countries changes. According to the task requirements, the average must be calculated based on the actual number of parsed population entries. Please update the average calculation to use totalResult / pop.length instead of a hardcoded value.
Additionally, there's a typo in the variable name avarage which should be corrected to average for proper spelling and consistency.
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
Important
Fix the issues, commit the changes, and then re-request my review using the Re-request review button2 in the Reviewers tab.
Tip
If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.
Caution
Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.
Footnotes
| totalResult += num; | ||
| }); | ||
|
|
||
| avarage.textContent = Math.floor(totalResult / 9).toLocaleString('en-US'); |
There was a problem hiding this comment.
The average calculation uses hardcoded 9 instead of dynamically using pop.length. This makes the code fragile - if the number of countries changes, the average will be incorrect. Use pop.length instead.
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Your solution is approved. All task requirements have been successfully implemented: the code correctly parses population data from spans, calculates both total and average values using dynamic pop.length for the divisor (not hardcoded), and formats the output with thousands separators using .toLocaleString('en-US'). The previous issues—a hardcoded divisor of 9 and the typo in the variable name—have been fixed. The .average-population and .total-population spans are properly updated with the calculated values. All checklist items pass and no critical blockers remain.
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
Uh oh!
There was an error while loading. Please reload this page.