- script.js
JavaScript
var calculateMiles = function (distance, isBusinessClass) {
if (isBusinessClass) {
return distance * 0.22;
} else {
return distance * 0.18;
}
// Move the code here
};
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 get ' + milesBusiness + ' miles');
Result
Goalscompleted
- Transfer the code from the
else
block down, after the condition operator. - Delete
else { }
block.
Comments