Let's count sum of number from 1 to 10. Now let's declare variable in which we'll store our sum:
let sum = 0;
Then let's have some for loop:
for (let i = 1; i <= 10; i++) {
In loop we have to increment our sum:
sum += i;
And then when we go out from loop, we can log our sum
console.log("Sum: ");
console.log(sum);