Skip to content

Commit 719c62e

Browse files
committed
add comment in the profile statistics project
1 parent 7f32e10 commit 719c62e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

projects/profile-statistics/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
const countersEl = document.querySelectorAll(".counter");
2-
2+
//Iterate over each elements in the counter
33
countersEl.forEach((counterEl) => {
4+
//Initial value of the counter to zero
45
counterEl.innerText = "0";
56
incrementCounter();
67
function incrementCounter() {
78
let currentNum = +counterEl.innerText;
89
const dataCeil = counterEl.getAttribute("data-ceil");
910
const increment = dataCeil / 15;
11+
//Math.ceil()= round to the nearest integer
1012
currentNum = Math.ceil(currentNum + increment);
1113

1214
if (currentNum < dataCeil) {

0 commit comments

Comments
 (0)