-
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
Top 10 largest countries #1537
base: master
Are you sure you want to change the base?
Top 10 largest countries #1537
Conversation
AlShramchemko
commented
Oct 23, 2024
- first try
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 your work! 🎉 While there are a few improvements suggested, like using a for...of
loop for better array iteration and refining your element selection, these are minor and don't impact the core functionality. Keep up the good work and consider these tips for future enhancements!
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
@@ -1,3 +1,35 @@ | |||
'use strict'; | |||
|
|||
// write your code here | |||
const populationCountry = document.querySelectorAll('span'); |
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 populationCountry
is intended to select elements with the class 'population', but it currently selects all 'span' elements. This does not align with the task requirement to get text data from 'span' elements with the class 'population'.
@@ -1,3 +1,35 @@ | |||
'use strict'; | |||
|
|||
// write your code here | |||
const populationCountry = document.querySelectorAll('span'); | |||
const len = document.querySelectorAll('.population').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 variable len
is correctly selecting elements with the class 'population', but it should be used to select 'span' elements with this class, similar to the correction needed for populationCountry
.
|
||
let totalSum = 0; | ||
|
||
for (const elem in massPupulation) { |
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 for...in
loop is not the best choice for iterating over arrays. Consider using a for...of
loop or a standard for
loop, as for...in
is intended for iterating over object properties and may lead to unexpected behavior with arrays.