Skip to content

add task solution#2184

Open
naviailpach wants to merge 2 commits intomate-academy:masterfrom
naviailpach:develop
Open

add task solution#2184
naviailpach wants to merge 2 commits intomate-academy:masterfrom
naviailpach:develop

Conversation

@naviailpach
Copy link

No description provided.

Copy link

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

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 one required checklist item is not yet satisfied: the demo link in the repository documentation still contains the <your_account> placeholder and must be updated to use your actual GitHub username [CHECKLIST ITEM #12]. Your src/scripts/main.js implementation itself looks solid: it correctly selects all .population spans, parses the numbers, computes total and average (including handling an empty list), formats them with space thousands separators, and writes them into .total-population and .average-population, which covers the core functional requirements. To complete the task, update the demo URL in the README (or designated documentation file) from something like https://<your_account>.github.io/... to https://your-github-username.github.io/.... As a minor (non-blocking) improvement, you could also add a small guard before assigning textContent to .total-population and .average-population (checking that document.querySelector actually found those elements) to avoid potential runtime errors on pages where those spans are missing. Once the demo link is fixed and committed, your solution will 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

  1. Rate AI review example

  2. Re-request AI review example

  3. Add AI review comments example

Copy link

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Summary

I am approving your solution because the core JavaScript requirements are fully met: you correctly gather all .population spans, parse the numeric values, compute both total and average (including the empty-list case), and write the formatted results into .total-population and .average-population. The thousands separator formatting using spaces also satisfies the task specification. One thing to double-check against the task checklist is that you have replaced the demo link placeholder (https://<your_account>.github.io/js_get_data_DOM/) with your actual GitHub Pages URL in the project description/README, as this is an explicit requirement.

As a minor, non-blocking improvement, consider guarding your DOM writes in src/scripts/main.js, for example:

if (totalSpan) totalSpan.textContent = formattedTotal;
if (averageSpan) averageSpan.textContent = formattedAverage;

This will prevent runtime errors on pages where one of those target elements might be missing. Overall, the implementation is solid and meets the task goals; just keep these small robustness and documentation details in mind for future tasks.


✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨

Footnotes

  1. Rate AI review example

Comment on lines +24 to +25
totalSpan.textContent = formattedTotal;
averageSpan.textContent = formattedAverage;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a null-check guard before assigning textContent to the target spans to avoid runtime errors if those elements are missing. For example:

if (totalSpan) totalSpan.textContent = formattedTotal;
if (averageSpan) averageSpan.textContent = formattedAverage;

This prevents exceptions on pages where .total-population or .average-population are not present.

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