「必要なすべての変数を定義したことを確認してください。」を取得する このCodeAcademyJavascriptスクリプトで。
// add a parameter called hourOfDay to the function
var taxiFare = function (milesTraveled, hourOfDay) {
var baseFare = 2.50;
var costPerMile = 2.00;
var nightSurcharge = 0.50; // 8pm to 6am, every night
var costs = baseFare + (costPerMile * milesTraveled);
if (hourOfDay > 20 || hourOfDay < 6)
costs = costs + nightSurcharge
end
return costs
};