Interactive online courses HTML Academy
2026-03-09 14:07 Diff
  • 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); }

Thanks! We’ll fix everything at once!

Result

  1. Add else and move consumptionTotal += consumptionPerPage; there.
  2. Change the economyMode value to true.