- script.js
JavaScript
var calculateMiles = function () {
var distance = 4125;
var percent = 0.25;
if (distance > 10500) {
percent = 0.35;
}
var miles = distance * percent;
console.log('We’ll get ' + miles + ' miles for the flight to Irkutsk');
};
Result
Goalscompleted
- Below, after the function declaration, log it in the console:
console.log(calculateMiles);
. - Replace function console log with calling
calculateMiles
.
Comments