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

add task solution #1424

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

StanislavKapytsia
Copy link

Calculate average and total numbers and it must be separated by a thousands separator.

Comment on lines 10 to 14
ArrayOfSelectorPopulation.forEach((selector) => {
const NUMBER = Number(selector.textContent.replaceAll(',', ''));

newTotal += NUMBER;
});

Choose a reason for hiding this comment

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

looks like you can simplify it using the reduce method

@@ -1,3 +1,20 @@
'use strict';

// write your code here
const ArrayOfSelectorPopulation = [...document.querySelectorAll('.population')];

Choose a reason for hiding this comment

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

Suggested change
const ArrayOfSelectorPopulation = [...document.querySelectorAll('.population')];
const arrayOfSelectorPopulation = [...document.querySelectorAll('.population')];

name vars and functions in camelCase

Copy link

@VitaliyBondarenko1982 VitaliyBondarenko1982 left a comment

Choose a reason for hiding this comment

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

GJ

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.

3 participants