- script.js
JavaScript
Result
Goalscompleted
- At the beginning of the code, create variable
sum
, which equals0
. - Below, after the variable, create a loop
for
, which increases the value of the counteri
from1
to10
inclusively. - Inside the loop, at each iteration, increase the sum by the counter value
sum += i;
. - In the body of the loop, after increasing
sum
, log'i: ' + i
in the console. - Then log
'sum: ' + sum
in the console.
Comments