daily pastebin goal
81%
SHARE
TWEET

Untitled

a guest Jul 12th, 2018 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //input golf function
  2. //% = modulus. think common factor
  3. function golfersPrice(numberOfGolfers){
  4.     let cost;
  5.   if (numberOfGolfers % 4) {
  6.       cost = 125;
  7.     } else {
  8.         cost = 100;
  9.     }
  10.     return cost;
  11.   }
  12. //adding number of golfers to reflect cost
  13. var numberOfGolfers = 0
  14.   console.log(golfersPrice(numberOfGolfers));
  15.   numberOfGolfers = 4;
  16.   console.log(golfersPrice(numberOfGolfers));
  17.   numberOfGolfers = 2;
  18.   console.log(golfersPrice(numberOfGolfers));
  19.   numberOfGolfers = 1;
  20.   console.log(golfersPrice(numberOfGolfers));
  21.   numberOfGolfers = 8;
  22.   console.log(golfersPrice(numberOfGolfers));
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