- script.js
JavaScript
var totalPages = 6; // Total number of pages
for (var page = 1; page <= totalPages; page++) {
muffin.print(page);
}
Result
Goalscompleted
- After the variable
totalPages, declare a variableconsumptionTotalequal to0. - After it, create a variable
consumptionPerPage. It equals70. - Inside the loop, after calling
muffin.print(), addconsumptionPerPagetoconsumptionTotalusing+=. - Below, in the loop, log the
consumptionTotalvalue in the console.
Comments