Develop#2144
Conversation
AndrewPrszn
commented
Jan 6, 2026
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Good work on this task! You've correctly implemented the logic to calculate and display the population data. However, one key requirement needs to be addressed before this can be approved. The task description specifies that you must 'Make sure that the given string can be converted to a number'. Your current code assumes this conversion will always be successful.
In src/scripts/main.js, if a <span> contained non-numeric text, the entire calculation would result in NaN. To fix this, please add a check after converting the string to a number to verify it's not NaN before you add it to the total. Using !isNaN() is a great way to handle this. This change 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
|
|
||
| for (const el of populations) { | ||
| const text = el.textContent; | ||
| const number = Number(text.replace(/,/g, '')); |
There was a problem hiding this comment.
The task description requires you to 'Make sure that the given string can be converted to a number'. This code assumes the conversion will always be successful. Consider adding a check after this line to verify that number is not NaN before you use it in calculations on the next line. This will make your code more robust against unexpected data in the HTML.
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Excellent work on this submission! I am approving your changes. You've done a great job addressing the feedback from the last review by adding the !isNaN check to ensure the population data is handled correctly. This makes the code more robust and reliable. All requirements for the task have now been fully met. Keep up the great work!
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨