Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Great work on the core logic for calculating the population data! However, I am requesting changes because two key requirements from the task description have not been met. First, the instructions state that only the src/scripts/main.js file should be modified, so please revert the changes made to the .scss files. Second, your code must validate that the population text can be converted to a number before performing calculations. Currently, a non-numeric value would result in NaN for the total and average. Please add a check to handle these cases, for example by filtering out invalid numbers.
✨ 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
src/scripts/main.js
Outdated
| const populations = Array.from(populationElement).map((element) => { | ||
| const text = element.textContent.replace(/,/g, '').trim(); | ||
|
|
||
| return Number(text); | ||
| }); |
There was a problem hiding this comment.
The task requires you to 'Make sure that the given string can be converted to a number'. Your current implementation doesn't account for cases where element.textContent might not be a valid number. If that happens, Number(text) will produce NaN, which will cause both the total and average to become NaN. Consider adding a check to ensure you are only working with valid numbers, for example by filtering out any NaN values from the populations array.
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Excellent work on the JavaScript logic! The validation to handle non-numeric data is implemented correctly, and the calculations are spot on.
However, I am requesting changes because the task has a strict requirement that only the src/scripts/main.js file should be modified. Your submission includes changes to files within the src/styles/ directory.
Please revert all modifications in the style files. Once you've done that, your solution will be ready for approval!
✨ 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
|
|
||
| body { | ||
| background: #eee; | ||
| counter-reset: section; |
There was a problem hiding this comment.
According to the task instructions, you should not make any changes to style files. Please revert all modifications in the src/styles/ directory.
No description provided.