- script.js
JavaScript
var percent = 0.25;
var distance = 4125;
if (distance > 10500) {
percent = 0.35;
}
var miles = distance * percent;
console.log('We’ll get ' + miles + ' miles for the flight to Irkutsk');
// Delete the code below
var percent = 0.25;
var distance = 11000;
if (distance > 10500) {
percent = 0.35;
}
var miles = distance * percent;
console.log('We’ll get ' + miles + ' miles for the flight to Kamchatka');
Result
Goalscompleted
- Delete the entire code for calculating the miles of the second flight (variables, condition and log in the console).
- Add function declaration for counting miles at the end of the program:
var calculateMiles = function () { };
. - Transfer the entire remaining code calculating miles into the body of the
calculateMiles
function.
Comments