Interactive online courses HTML Academy
2026-03-09 12:23 Diff
  • script.js

JavaScript

var totalPages = 6; // Total number of pages var consumptionTotal = 0; // Total toner consumption var consumptionPerPage = 70; // Toner consumption per page for (var page = 1; page <= totalPages; page++) { muffin.print(page); // Add the check here consumptionTotal += consumptionPerPage; console.log(consumptionTotal); }

Thanks! We’ll fix everything at once!

Result

  1. After the consumptionPerPage variable, create variable economyMode, which contains false.
  2. In the loop after calling muffin.print(), add a condition that works if economyMode equals true and if the number of the current page page is greater than 3.
  3. Inside this condition, increase consumptionTotal by consumptionPerPage * 0.5 with the help of the += operator.