Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

AlShramchemko
Copy link

  1. first try

Copy link

@mateacademy-ai-mentor mateacademy-ai-mentor left a 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');

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;

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) {

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.

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