HTML Diff
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) { if (isBusinessClass) { return distance * 0.22; } return distance * 0.18; }; 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’ll save ' + milesBusiness + ' miles');</p>
3 <p>var calculateMiles = function (distance, isBusinessClass) { if (isBusinessClass) { return distance * 0.22; } return distance * 0.18; }; 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’ll 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 body of the function, it the very beginning, create variable percent equal to 0.18 on the 2nd line.</li>
6 <ol><li>In the body of the function, it the very beginning, create variable percent equal to 0.18 on the 2nd line.</li>
7 <li>Inside the condition, instead of calculating miles, increase variable percent by 0.04.</li>
7 <li>Inside the condition, instead of calculating miles, increase variable percent by 0.04.</li>
8 <li>Replace the expression that the function returns with distance * percent.</li>
8 <li>Replace the expression that the function returns with distance * percent.</li>
9 </ol>
9 </ol>