Skip to content

First attempt#2301

Closed
Nikk241 wants to merge 1 commit into
mate-academy:masterfrom
Nikk241:develop
Closed

First attempt#2301
Nikk241 wants to merge 1 commit into
mate-academy:masterfrom
Nikk241:develop

Conversation

@Nikk241

@Nikk241 Nikk241 commented Jul 8, 2026

Copy link
Copy Markdown

First attempt commit.

@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

I am requesting changes because there are still critical issues that block the task from being fully completed. First, the selector for the average span uses the class .avarage-population instead of the required .average-population, so your computed average is never written to the correct element [CHECKLIST ITEM #6]. Please update both the class name in the JavaScript and any related variable names so the span with class="average-population" is correctly targeted and updated.

Second, you directly call Number(cleanedText) without first confirming that cleanedText is a valid numeric string, which violates the requirement to ensure the string can be converted to a number before conversion [CHECKLIST ITEM #14]. You can fix this by adding a guard such as if (!isNaN(cleanedText) && cleanedText !== '') or a regex check before pushing to populationNumbers and including only valid entries in your calculations. Once these issues are corrected, your logic for collecting, summing, averaging, and formatting the population values should satisfy the task requirements. Overall, your core approach looks solid; these targeted fixes will bring it fully in line with the specification.


✨ 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
Comment on lines +6 to +9
const populationNumbers = [...populationSpans].map(span => {
const text = span.textContent;
const cleanedText = text.replace(/,/g, '');
return Number(cleanedText);

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 task requires making sure the string can be converted to a number before converting it; here you directly call Number(cleanedText) without any validation. Consider checking that the cleaned text represents a valid numeric value (e.g., via regex or isNaN) before including it in populationNumbers, per checklist item #14.

Comment thread src/scripts/main.js
const avarage = Math.round(total / populationNumbers.length);

const totalSpan = document.querySelector('.total-population');
const avarageSpan = document.querySelector('.avarage-population');

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 class name here (.avarage-population) does not match the task description, which specifies average-population. This will prevent the average value from being written to the correct span and violates checklist item #6.

@Nikk241 Nikk241 closed this by deleting the head repository Jul 8, 2026
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