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) { var percent = 0.18; if (isBusinessClass) { percent += 0.04; } if (distance &gt; 3500) { percent += 0.15; } return distance * percent; }; var calculateFlights = function (distance, isBusinessClass) { var miles = calculateMiles(distance, isBusinessClass); console.log('Miles for the flight: ' + miles); }; calculateFlights(3118, true);</p>
3 <p>var calculateMiles = function (distance, isBusinessClass) { var percent = 0.18; if (isBusinessClass) { percent += 0.04; } if (distance &gt; 3500) { percent += 0.15; } return distance * percent; }; var calculateFlights = function (distance, isBusinessClass) { var miles = calculateMiles(distance, isBusinessClass); console.log('Miles for the flight: ' + miles); }; calculateFlights(3118, true);</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>Create third parameter milesTarget in calculateFlights function and transfer third argument 15000 in the call of calculateFlights function.</li>
6 <ol><li>Create third parameter milesTarget in calculateFlights function and transfer third argument 15000 in the call of calculateFlights function.</li>
7 <li>Inside calculateFlights function, after logging miles in the console, declare variable flights, which equals milesTarget / miles.</li>
7 <li>Inside calculateFlights function, after logging miles in the console, declare variable flights, which equals milesTarget / miles.</li>
8 <li>Log the number of flights in the console 'Number of flights:' + flights.</li>
8 <li>Log the number of flights in the console 'Number of flights:' + flights.</li>
9 <li>Round the number of flights up Math.ceil(milesTarget / miles).</li>
9 <li>Round the number of flights up Math.ceil(milesTarget / miles).</li>
10 </ol>
10 </ol>