-
Notifications
You must be signed in to change notification settings - Fork 2k
complete #2156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
complete #2156
Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Summary
Excellent work on the core logic! You've successfully parsed the data, calculated the total and average, and formatted the output correctly.
I'm requesting one change to fully meet the task requirements. The instructions specify to "Make sure that the given string can be converted to a number." Your current implementation is missing this validation step. Without it, non-numeric data could lead to NaN (Not a Number) in your results, which would break the display.
To fix this, please add a check to ensure a string is a valid number before you convert and add it to the populations array. A simple if condition using !isNaN() would be a great way to handle this. This change will make your code more robust and complete.
✨ 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
|
|
||
| populationSpans.forEach((span) => { | ||
| const text = span.textContent; | ||
| const number = Number(text.replace(/,/g, '')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to the task requirements, you need to "Make sure that the given string can be converted to a number". This implementation assumes the conversion will always be successful. Consider adding a check (e.g., using !isNaN(number)) to ensure you only push valid numbers to the populations array. This makes your code more robust against unexpected data.
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Summary
Excellent work addressing the feedback! You've successfully added the validation to check if a string can be converted to a number before it's used in any calculations. Your solution is now robust, clean, and fully meets all the task requirements. I'm happy to approve this submission. Well done!
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
No description provided.