- script.js
JavaScript
var totalPages = 6; // Total number of pages
var consumptionTotal = 0; // Total toner consumption
var consumptionPerPage = 70; // Toner consumption per page
var economyMode = false;
for (var page = 1; page <= totalPages; page++) {
muffin.print(page);
if (economyMode && page > 3) {
consumptionTotal += consumptionPerPage * 0.5;
}
consumptionTotal += consumptionPerPage;
console.log(consumptionTotal);
}
Result
Goalscompleted
- Add
elseand moveconsumptionTotal += consumptionPerPage;there. - Change the
economyModevalue totrue.
Comments