generated from mate-academy/gulp-template
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
AndriiYelieva
committed
Oct 12, 2023
1 parent
b3e92cb
commit 770745e
Showing
6 changed files
with
67 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,49 @@ | ||
{ | ||
"extends": "@mate-academy/linthtml-config" | ||
"attr-bans": [ | ||
"align", | ||
"background", | ||
"bgcolor", | ||
"border", | ||
"frameborder", | ||
"style" | ||
], | ||
"attr-name-ignore-regex": "viewBox", | ||
"attr-no-dup": true, | ||
"attr-quote-style": "double", | ||
"attr-req-value": true, | ||
"class-no-dup": true, | ||
"doctype-first": true, | ||
"doctype-html5": true, | ||
"fig-req-figcaption": true, | ||
"head-req-title": true, | ||
"html-req-lang": true, | ||
"id-class-style": false, | ||
"id-no-dup": true, | ||
"img-req-src": true, | ||
"img-req-alt": "allownull", | ||
"indent-width": 2, | ||
"indent-style": "spaces", | ||
"indent-width-cont": true, | ||
"input-radio-req-name": true, | ||
"spec-char-escape": true, | ||
"tag-bans": [ | ||
"b", | ||
"i", | ||
"u", | ||
"center", | ||
"style", | ||
"marquee", | ||
"font", | ||
"s" | ||
], | ||
"tag-name-lowercase": true, | ||
"tag-name-match": true, | ||
"tag-self-close": "never", | ||
"tag-close": true, | ||
"text-ignore-regex": "&", | ||
"title-no-dup": true, | ||
"line-end-style": "lf", | ||
"attr-new-line": 2, | ||
"attr-name-style": "dash", | ||
"attr-no-unsafe-char": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,18 @@ | ||
'use strict'; | ||
|
||
// write your code here | ||
const nodeListState = document.querySelectorAll('.population'); | ||
const total = document.querySelector('.total-population'); | ||
const average = document.querySelector('.average-population'); | ||
|
||
const states = [...nodeListState].map(state => { | ||
const conversionToNumber = state.innerHTML.split(',').join(''); | ||
|
||
return +conversionToNumber; | ||
}); | ||
|
||
const totalPopulation = states.reduce((accumulator, currentState) => { | ||
return accumulator + currentState; | ||
}, 0); | ||
|
||
total.innerHTML = totalPopulation.toLocaleString('en-US'); | ||
average.innerHTML = (totalPopulation / states.length).toLocaleString('en-US'); |