SHARE
TWEET

Untitled

a guest May 5th, 2012 25 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // add a parameter called hourOfDay to the function
  2. var taxiFare = function (milesTraveled, hourOfDay) {
  3.   var baseFare = 2.50;
  4.   var costPerMile = 2.00;
  5.   var nightSurcharge = 0.50; // 8pm to 6am, every night
  6.  
  7.   var cost = baseFare + (costPerMile * milesTraveled);
  8.   if (hourOfDay >= 20 || hourOfDay < 6); {
  9.   return cost + nightSurcharge; }
  10.   else { //here's where the error message flags up
  11.   return cost
  12.   }
  13. };
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top