-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add task solution #1536
base: master
Are you sure you want to change the base?
add task solution #1536
Conversation
pasha28091997
commented
Oct 22, 2024
- [DEMO LINK] (https://pasha28091997.github.io/js_get_data_DOM/)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like there are a few critical issues related to formatting numbers with a thousands separator, which is a core requirement of the task. Please address these formatting issues to ensure the numbers are displayed correctly. Keep up the great work, and I'm sure you'll nail it! 😊
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
🔄 Fix the issues, commit the changes, and then re-request my review using the Re-request review
button in the Reviewers tab.
allPopulationNumber += +key.innerHTML.replaceAll(',', ''); | ||
} | ||
|
||
const averagePopulation = allPopulationNumber / element.length; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The calculated averagePopulation should be formatted with a thousands separator to match the numeric style of the populations presented, as required by the task description.
src/scripts/main.js
Outdated
|
||
const classTotalPopulation = document.querySelector('.total-population'); | ||
|
||
classTotalPopulation.innerHTML = allPopulationNumber; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The total population number should be formatted with a thousands separator before being assigned to the innerHTML of classTotalPopulation, as required by the task description.
src/scripts/main.js
Outdated
|
||
const classAveragePopulation = document.querySelector('.average-population'); | ||
|
||
classAveragePopulation.innerHTML = averagePopulation; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The average population number should be formatted with a thousands separator before being assigned to the innerHTML of classAveragePopulation, as required by the task description.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job on implementing the solution! 🎉 Your code successfully retrieves population data, calculates the total and average, and updates the DOM as required. However, there's a minor issue with the variable formattedallPopulationNumber
where it's incorrectly assigned the formatted average population instead of the total population. Make sure to format allPopulationNumber
instead of averagePopulation
. This decision to approve is to help you move forward with your learning. Please review the comments to improve your code. Keep up the good work and continue learning from these experiences!
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
src/scripts/main.js
Outdated
|
||
const classTotalPopulation = document.querySelector('.total-population'); | ||
|
||
const formattedallPopulationNumber = averagePopulation.toLocaleString('uk-UA'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The variable formattedallPopulationNumber
is incorrectly assigned the formatted average population instead of the total population. It should format allPopulationNumber
instead of averagePopulation
.