- At the beginning of the code, create variable
sum, which equals
- Below, after the variable, create a loop
for, which increases the value of the counter
- Inside the loop, at each iteration, increase the sum by the counter value
sum += i;.
- In the body of the loop, after increasing
'i: ' + iin the console.
- Then log
'sum: ' + sumin the console.