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 > 3500) { percent += 0.15; } return distance * percent; }; var calculateFlights = function (distance, isBusinessClass, milesTarget) { var miles = calculateMiles(distance, isBusinessClass); console.log('Miles for the flight: ' + miles); var flights = Math.ceil(milesTarget / miles); console.log('Number of flights: ' + flights); }; calculateFlights(3118, true, 15000);</p>
3
<p>var calculateMiles = function (distance, isBusinessClass) { var percent = 0.18; if (isBusinessClass) { percent += 0.04; } if (distance > 3500) { percent += 0.15; } return distance * percent; }; var calculateFlights = function (distance, isBusinessClass, milesTarget) { var miles = calculateMiles(distance, isBusinessClass); console.log('Miles for the flight: ' + miles); var flights = Math.ceil(milesTarget / miles); console.log('Number of flights: ' + flights); }; calculateFlights(3118, true, 15000);</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>Inside the calculateFlights function, delete log of values in the console.</li>
6
<ol><li>Inside the calculateFlights function, delete log of values in the console.</li>
7
<li>Return the number of flights using return from the calculateFlights function.</li>
7
<li>Return the number of flights using return from the calculateFlights function.</li>
8
<li>Replace the calculateFlights(3118, true, 15000) function call with logging the following message in the console 'Required number of flights in business class to Valencia: ' + calculateFlights(3118, true, 15000).</li>
8
<li>Replace the calculateFlights(3118, true, 15000) function call with logging the following message in the console 'Required number of flights in business class to Valencia: ' + calculateFlights(3118, true, 15000).</li>
9
<li>Add one more message below 'Required number of economy flights to Lisbon: ' + calculateFlights(3617, false, 15000).</li>
9
<li>Add one more message below 'Required number of economy flights to Lisbon: ' + calculateFlights(3617, false, 15000).</li>
10
</ol>
10
</ol>