Skip to content

Develop - #2391

Open
levjake wants to merge 4 commits into
mate-academy:masterfrom
levjake:develop
Open

Develop#2391
levjake wants to merge 4 commits into
mate-academy:masterfrom
levjake:develop

Conversation

@levjake

@levjake levjake commented Nov 4, 2026 •

Copy link
Copy Markdown

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

  1. Rate AI review example ↩

  2. Re-request AI review example ↩

  3. Add AI review comments example ↩

Comment thread src/scripts/main.js Outdated
totalResult += num;
});

avarage.textContent = Math.floor(totalResult / 9).toLocaleString('en-US');

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 mateacademy-ai-mentor left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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! ✨

Footnotes

  1. Rate AI review example ↩

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants