0 added
0 removed
Original
2026-01-01
Modified
2026-03-09
1
<ul><li>script.js</li>
1
<ul><li>script.js</li>
2
</ul><p>JavaScript</p>
2
</ul><p>JavaScript</p>
3
<p>var calculateMiles = function (distance, isBusinessClass) { var percent = 0.18; if (isBusinessClass) { percent += 0.04; } return distance * percent; }; var milesEconom = calculateMiles(3000, false); var milesBusiness = calculateMiles(3000, true); console.log('With economy class from MuffAir, you’ll get ' + milesEconom + ' miles'); console.log('With business class of MuffAir, you will save ' + milesBusiness + ' miles');</p>
3
<p>var calculateMiles = function (distance, isBusinessClass) { var percent = 0.18; if (isBusinessClass) { percent += 0.04; } return distance * percent; }; var milesEconom = calculateMiles(3000, false); var milesBusiness = calculateMiles(3000, true); console.log('With economy class from MuffAir, you’ll get ' + milesEconom + ' miles'); console.log('With business class of MuffAir, you will save ' + milesBusiness + ' miles');</p>
4
<p>Thanks! We’ll fix everything at once!</p>
4
<p>Thanks! We’ll fix everything at once!</p>
5
<h2>Result</h2>
5
<h2>Result</h2>
6
<ol><li>In the calculateMiles function after checking the flight class, add another check. If the distance is greater than 3500 km, the percentage increases by another 0.15.</li>
6
<ol><li>In the calculateMiles function after checking the flight class, add another check. If the distance is greater than 3500 km, the percentage increases by another 0.15.</li>
7
<li>Increase the distance in both function calls to 10000 to make sure that the number of miles has increased.</li>
7
<li>Increase the distance in both function calls to 10000 to make sure that the number of miles has increased.</li>
8
</ol>
8
</ol>