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

task_done_js_get_data_DOM #1457

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

Conversation

Anastasiia-Tatarchenko
Copy link

Comment on lines 9 to 13
population.forEach((county) => {
const value = parseInt(county.textContent.replaceAll(',', ''));

valuesArray.push(value);
});

Choose a reason for hiding this comment

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

you can simplify it using the map

Comment on lines 18 to 30
function preparePopulation(param) {
const prepared = ('' + param).split('').reverse();
let res = '';

for (let i = 0; i < prepared.length; i++) {
if (i !== 0 && i % 3 === 0) {
res += ',';
}
res += prepared[i];
}

return res.split('').reverse().join('');
}

Choose a reason for hiding this comment

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

you can just use the .toLocaleString()

Copy link

@anastasiiavorobiova anastasiiavorobiova left a comment

Choose a reason for hiding this comment

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

Awesome!

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