Skip to content

calc ave / total#2238

Open
Evgen-Krasnenkov wants to merge 3 commits intomate-academy:masterfrom
mate-tasks:js-dom-feature
Open

calc ave / total#2238
Evgen-Krasnenkov wants to merge 3 commits intomate-academy:masterfrom
mate-tasks:js-dom-feature

Conversation

@Evgen-Krasnenkov
Copy link
Copy Markdown

No description provided.

Copy link
Copy Markdown

@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.

Review Summary

Great work on this task! Your solution correctly implements all the functional requirements, calculating and displaying the total and average population perfectly. I am approving your submission. Please take a look at the build logs, as there's a linting error about an unused variable: error 'pop' is assigned a value but never used. You also have another unused variable, spaned, which can be removed to clean up the code. As a suggestion for future improvement, you can make your code even more concise by removing the manual counter i and using the length property of your element collection instead. Keep up the excellent work!


✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨

Important

Fix the issues, commit the changes, and then re-request my review using the Re-request review button2 in the Reviewers tab.

Tip

If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.

Caution

Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.

Footnotes

  1. Rate AI review example

  2. Re-request AI review example

  3. Add AI review comments example

let total = 0;
let i = 0;

Array.from(clazz).forEach((element) => {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This manual counter i isn't necessary. You can get the number of population elements directly from the length property of the clazz collection (i.e., clazz.length). This would allow you to remove this variable and the i++ inside your loop, making the code simpler.

Comment on lines 3 to +4
body {
background: #eee;
counter-reset: section;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These variables, spaned and pop, are declared but never used. It's good practice to remove unused code to keep your script clean and easier to read.

display: flex;
margin: 0;
align-items: center;
justify-content: center;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This counter variable i isn't necessary. The clazz object is a collection that has a .length property, which you can use to get the count of elements. You could calculate the average after the loop with total / clazz.length and remove i and i++ completely.

Copy link
Copy Markdown

@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.

Review Summary

Excellent work on this pull request! You've successfully addressed the feedback from the previous review by removing the unused variables, making your code cleaner and more efficient. Your solution now meets all the requirements of the task, correctly calculating and displaying the population data. I am happy to approve your submission. Keep up the great work!


✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨

Footnotes

  1. Rate AI review example

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