- script.js
JavaScript
var calculateMiles = function (distance, isBusinessClass) {
if (isBusinessClass) {
return distance * 0.22;
} else {
return distance * 0.18;
}
};
Result
Goalscompleted
- After defining the function, create variable
milesEconom
, which is equal to the result of the expressioncalculateMiles(3000, false);
. - Create another variable
milesBusiness
, which is equal to the result ofcalculateMiles(3000, true);
. - Log the following message in the console
'With economy class from MuffAir, you’ll get ' + milesEconom + ' miles'
. - And then log this message in the console
'With business class of MuffAir, you’ll get ' + milesBusiness + ' miles'
.
Comments