added solution#2291
Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
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
|
|
||
| totalElement.textContent = `${total.toLocaleString('en-US')}`; | ||
|
|
||
| const avarage = Math.floor(total / populationElement.length); |
There was a problem hiding this comment.
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.
No description provided.