- script.js
JavaScript
Result
Goalscompleted
- At the beginning of the code, create variable
sum, which equals0. - Below the variable declaration, add a
forloop that countsifrom1to10inclusive. - 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: ' + iin the console. - Then log
'sum: ' + sumin the console.
Comments