1let n = 6;
2let total = 0;
3
4for (let i = 1; i <= n; i++) {
5 total += i;
6}
7
8console.log(total);
9
10/*The variable total is initialized to 0. The loop executes once each for
11 the values of i from 1 to 6. Each time the loop body executes, the
12next value of i is added to total.*/