- 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 variableconsumptionTotal
equal to0
. - After it, create a variable
consumptionPerPage
. It equals70
. - Inside the loop, after initiating the
muffin.print()
command, increase the value ofconsumptionTotal
variable byconsumptionPerPage
with the help of the+=
operator. - Below, in the loop, log the
consumptionTotal
value in the console.
Comments