Skip to content

added solution#2291

Open
Skoulskiy wants to merge 1 commit into
mate-academy:masterfrom
Skoulskiy:develop
Open

added solution#2291
Skoulskiy wants to merge 1 commit into
mate-academy:masterfrom
Skoulskiy:develop

Conversation

@Skoulskiy

Copy link
Copy Markdown

No description provided.

@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

Your solution is approved because it correctly parses all .population span values, converts them to numbers (stripping commas), and computes both total and average from those numeric values as required. The results are written into .total-population and .average-population, and you format them with toLocaleString('en-US'), which satisfies the thousands-separator requirement and keeps the output consistent with the input format. Functionally, this meets the key checklist items about using parsed numbers for calculations, updating the correct DOM elements, and not altering HTML or CSS structure.

Two minor, non-blocking improvements you might consider: rename avarage/avarageElement to average/averageElement for clarity, and base your average calculation on populations.length rather than populationElement.length so the intent is clearer. Also, double-check outside this file that you’ve replaced <your_account> in the demo link and that you’ve run npm run lint as requested, since those can’t be verified from the code alone. Overall, this is a solid and compliant implementation—nice work aligning closely with the task requirements.


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

Footnotes

  1. Rate AI review example

Comment thread src/scripts/main.js

totalElement.textContent = `${total.toLocaleString('en-US')}`;

const avarage = Math.floor(total / populationElement.length);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Using populationElement.length works here because each .population element maps to one entry in populations, but conceptually it can be clearer to base the average on populations.length since that’s the actual numeric dataset you’re averaging.

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