js_get_data_DOM - #2307
Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
I am approving your solution because it correctly implements all of the core functional requirements for this task. Your main.js code gathers all .population spans, strips the thousands separators, converts the values to numbers, and then accurately computes both the total and the average. You then replace the Calculate it! placeholders in .total-population and .average-population with the computed values, formatting them using toLocaleString('en-US') so the output matches the given population style. You also respected the technical constraints by leaving the HTML and SCSS files unchanged and implementing the logic only in main.js. The only potential improvement (not a blocker) would be to defensively check for NaN before adding values to the total, in case any unexpected non-numeric text appears in a .population span in the future. Overall, this is a clear, focused solution that meets the task requirements well.
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
<142536Def>with your Github username in the linknpm run lintcommand instead ofnpm testTask: TOP 9 LARGEST COUNTRIES BY POPULATION
Hello! In this task, you need to parse data from the list, and based on it get the average and total value.
You no need to change styles or HTML layout in this task. Change only
main.jsfile.Steps to do this challenge:
spanwith classpopulationCalculate it!with calculated average numbers inspanwith classesaverage-populationandtotal-population.averageandtotalnumbers must be separated by a thousands separator (same numeric style as populations presented).