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) { var percent = 0.25; if (distance > 10500) { percent = 0.35; } var miles = distance * percent; console.log('We’ll get ' + miles + ' miles for the flight'); }; calculateMiles(4125); calculateMiles(11000);</p>
3
<p>var calculateMiles = function (distance) { var percent = 0.25; if (distance > 10500) { percent = 0.35; } var miles = distance * percent; console.log('We’ll get ' + miles + ' miles for the flight'); }; calculateMiles(4125); calculateMiles(11000);</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>Edit the value of the variable miles rounding the result of calculations Math.floor(distance * percent);.</li>
6
<ol><li>Edit the value of the variable miles rounding the result of calculations Math.floor(distance * percent);.</li>
7
<li>Inside the function, replace console log message with return miles;.</li>
7
<li>Inside the function, replace console log message with return miles;.</li>
8
<li>Replace the first function call with console log message 'We’ll get ' + calculateMiles(4125) + ' for the flight to Irkutsk'.</li>
8
<li>Replace the first function call with console log message 'We’ll get ' + calculateMiles(4125) + ' for the flight to Irkutsk'.</li>
9
<li>Replace the second function call with console log message 'We will get ' + calculateMiles(11000) + ' miles for the flight to Kamchatka'.</li>
9
<li>Replace the second function call with console log message 'We will get ' + calculateMiles(11000) + ' miles for the flight to Kamchatka'.</li>
10
</ol>
10
</ol>