Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Great job on implementing the calculation and formatting for the total and average population! Your code works correctly with the current data.
However, I'm requesting a change because a key requirement from the task description is missing. You need to add a check to ensure that the population string can be converted to a number before you use it in your calculations. Without this validation, if one of the <span> elements contained text that wasn't a number, the entire calculation would result in NaN.
Please add a check, for example using !isNaN(), to guard against this possibility. This will make your code more robust and fully meet the task requirements.
✨ 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
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Great job adding the !isNaN check to make your total calculation more robust! That was the main point of the last review, and you've handled it well.
However, this has introduced a subtle issue in how the average is calculated, which requires a change. While your total correctly ignores non-numeric values, the average is still being calculated by dividing by the total number of elements, including the invalid ones.
To fix this, the divisor for the average should be the count of only the valid numbers that were included in the total sum. You'll need to track this count separately.
✨ 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
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Excellent work! I am approving your solution. You've successfully addressed the feedback from the previous review, and the logic for calculating the average is now correct. The code is well-structured, robust, and meets all the task requirements. Great job on this iteration!
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
No description provided.